Skip to content

Instantly share code, notes, and snippets.

@typester
Created August 20, 2009 12:19
Show Gist options
  • Save typester/171032 to your computer and use it in GitHub Desktop.
Save typester/171032 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use YAML;
use AnyEvent;
use AnyEvent::Run;
my $cv = AnyEvent->condvar;
my $w = AnyEvent::Run->new(
cmd => sub {
print "foo!\n";
sleep 1;
print "bar!\n";
sleep 2;
print "baz!\n";
},
);
$w->on_eof(
sub {
warn 'on eof!';
$cv->send;
},
);
$w->on_read(sub {
shift->push_read( line => sub {
warn 'read: ', $_[1];
});
});
$cv->recv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment