Skip Menu |
 

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 42253
Status: rejected
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: ajrothstein [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Problem with Wheel::ReadWrite on Windows
Date: Fri, 9 Jan 2009 11:44:26 +0200
To: bug-POE [...] rt.cpan.org
From: "Alan Rothstein" <ajrothstein [...] gmail.com>
Download (untitled) / with headers
text/plain 5.2k
Hi, I seem to be having a problem with Wheel::ReadWrite on Windows. Given the code below (basically I took the logwatcher code from the cookbook and changed it to use ReadWrite instead of Followtail: #!/usr/bin/perl -w use POE qw/Wheel::ReadWrite/; use strict; use FileHandle; $| = 1; my $filename = $ARGV[0]; die "Usage: $0 <filename>\n" unless $filename; die "$0: $filename: No such file or directory\n" unless -e $filename; die "$0: $filename: Permission denied\n" unless -r $filename; my ($fh) = new FileHandle "<$filename"; POE::Session->create ( inline_states => { _start => \&start, got_line => sub { print "$_[ARG0]\n" }, got_error => sub { warn "$_[ARG0]\n" }, _stop => sub { die "$_[ARG0]\n" }, } ); sub start { $_[HEAP]->{wheel} = POE::Wheel::ReadWrite->new( Handle => $fh, InputEvent => 'got_line', ErrorEvent => 'got_error', ); } $poe_kernel->run(); with POE_ASSERT_DEFAULT=1 I get the following: Please mail the following information to bug-POE@rt.cpan.org: <fh> select error: Unknown error at C:/Perl/site/lib/POE/Loop/Select.pm line 214 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x1a807f4)') called at C:/Perl/site/lib/POE/Loop/Select.pm line 335 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x1a807f4)') called at C:/Perl/site/lib/POE/Kernel.pm line 1286 POE::Kernel::run('POE::Kernel=ARRAY(0x1a807f4)') called at C:\ajr\home\ken\ken\release\test-ft.pl line 35 Please mail the following information to bug-POE@rt.cpan.org: <fh> select error: Unknown error at C:/Perl/site/lib/POE/Loop/Select.pm line 214 POE::Kernel::loop_do_timeslice('POE::Kernel=ARRAY(0x1a807f4)') called at C:/Perl/site/lib/POE/Loop/Select.pm line 335 POE::Kernel::loop_run('POE::Kernel=ARRAY(0x1a807f4)') called at C:/Perl/site/lib/POE/Kernel.pm line 1286 POE::Kernel::run('POE::Kernel=ARRAY(0x1a807f4)') called at C:\ajr\home\ken\ken\release\test-ft.pl line 35 <us> must call state() from a running session at C:/Perl/site/lib/POE/Kernel.pm line 2506 POE::Kernel::state('POE::Kernel=ARRAY(0x1a807f4)', 'POE::Wheel::ReadWrite(1) -> select read') called at C:/Perl/site/lib/POE/Wheel/ReadWrite.pm line 403 POE::Wheel::ReadWrite::DESTROY('POE::Wheel::ReadWrite=ARRAY(0x1c589bc)') called at C:\ajr\home\ken\ken\release\test-ft.pl line 0 eval {...} called at C:\ajr\home\ken\ken\release\test-ft.pl line 0 This is the output of perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=MSWin32, osvers=5.00, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='12.00.8804', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86' libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl510.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 1004 [287188] 33741 avoids segfaults invoking S_raise_signal() (on Linux) 33763 Win32 process ids can have more than 16 bits 32809 Load 'loadable object' with non-default file extension 32728 64-bit fix for Time::Local Built under MSWin32 Compiled at Sep 3 2008 13:16:37 @INC: C:/Perl/site/lib C:/Perl/lib . I am using the latest subversion release of POE. (I tried 1.003 first. Same problem) This works on Linux 1.003 no problem. Thanks in advance for any help. - Alan -
Download (untitled) / with headers
text/plain 699b
The problem is that you're trying to watch a filehandle that represents a file on disk. POE::Wheel::ReadWrite uses POE::Kernel's select_read(), which uses Perl's select() or some other event loop that eventually gets around to select(). Unfortunately select() comes from Microsoft's WinSock (Windows sockets) library. As a result, select() may only operate on sockets. It cannot be used to watch plain files, terminals, or anything else. POE::Wheel::FollowTail does not use select_read(), so it is not susceptible to Perl's select() limitations on Windows. Rather, it works by polling the file for new data with a periodic timer. So in short: I'm sorry it doesn't work. It's a Windows thing.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.