Skip to content

Instantly share code, notes, and snippets.

@ainame
Created August 14, 2011 05:12
Show Gist options
  • Save ainame/1144609 to your computer and use it in GitHub Desktop.
Save ainame/1144609 to your computer and use it in GitHub Desktop.
AnyEventでファイルの読み込み
use 5.010;
use strict;
use warnings;
use autodie;
use AnyEvent;
open my $fh, '< hoge.txt';
my $cv = AnyEvent->condvar();
my $reader = AnyEvent->io(
fh => $fh,
poll => 'r',
cb => sub {
print <$fh>;
$cv->send();
}
);
$cv->recv();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment