I am trying to get AnyEvent to work on what I thought would be a simple bit code. My code does not work.
Clearly I have misunderstood something. I am trying run the following on a Windows PC. There are two processes, one a very simple routine which opens and appends data to a file and the second to read the data as and when it is written.However the code just terminates with the following:-use strict; use warnings; use AnyEvent; use AnyEvent::Strict; open(my $fh, '<', 'C:/Temp/TestFile.txt') or die $!; my $done = AnyEvent->condvar; my $watcher = AnyEvent->io ( fh => $fh , poll => 'r' , cb => sub { my $input = <$fh>; print "Input [$input]\n"; if ( $input =~ /^End of processing file/ ) {$done->sen +d; } } ); $done->recv; close $fh or die $!; print "All done!\n";
Please can one point out what I have done wrong? Thanks.AnyEvent->io called with fh argument pointing to a file at script\test +\AnyEvent0.pl line 18.
In reply to AnyEvent trying to read from a file by wheelej
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |