Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^2: Problem with POE-Component-DirWatch

by runrig (Abbot)
on Mar 13, 2006 at 18:03 UTC ( #536328=note: print w/replies, xml ) Need Help??

in reply to Re: Problem with POE-Component-DirWatch
in thread Problem with POE-Component-DirWatch

I tested the code also (how did you test it?). While the program was running, I created a file with a name ending in ".gz", and the module did not detect it. In debugging the module, I found that the same list of files was being processed over and over, without the new file ever being in the list, BEFORE the filtering even took place. I suspect it's a difference in the way rewinddir behaves on Win32 vs. *nix (instead of opening the directory with opendir, it just rewinds the previously opened directory handle and then reads the files again from the same handle). And if your test was valid, then maybe it also depends on the version of Windows and/or perl?
  • Comment on Re^2: Problem with POE-Component-DirWatch

Replies are listed 'Best First'.
Re^3: Problem with POE-Component-DirWatch
by benlaw (Scribe) on Mar 13, 2006 at 22:54 UTC
    Thanks for all monks! I try to modify the filter to
    Filter => sub { $_[0] =~ /.txt$/ && -f $_[1] },
    then I re-run, it print the following message repeatly until i del file test.txt manually
    Tue Mar 14 06:41:06 2006 test.txt (C:\temp\test.txt) Tue Mar 14 06:41:06 2006 test.txt (C:\temp\test.txt)
    however I try paste new_test.txt to c:\temp\, it seems no response (May be the same with runrig) my perl version is "v5.8.4 built for MSWin32-x86-multi-thread"
      Find the rewind line in the poll subroutine in the module and replace it with:
      # rewind to directory start # $heap->{DirHandle}->rewind; $heap->{DirHandle}->close; $heap->{DirHandle}->open($heap->{Directory}) or croak "Can't open $heap->{Directory}: $!\n";
      The module and your code seem to work with the above changes. (I've emailed the module author with a link to this thread).

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://536328]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2021-09-24 01:17 GMT
Find Nodes?
    Voting Booth?

    No recent polls found