Hello, Marc,

this works:

- snip --

use Event;

die "Usage: $0 <filename>\n" unless @ARGV and -e $ARGV[0];

my $fh = do { local *GLOB };
open $fh, "<", $ARGV[0] or die $!;

print "fileno: ", fileno $fh, "\n";
print "asstring: $fh\n";

# here is the difference
Event->io(fd=>\$fh, cb=>\&callback);

Event::loop;

# demo callback
sub callback
 {
  my ($event)=@_;
  my $ifh=$event->w->fd;

  my $line=<$ifh>;
  print $line;

  Event::unloop if eof($ifh);
 }

- snip --

Greetings

                Jochen

Reply via email to