Created
          August 20, 2009 12:19 
        
      - 
      
- 
        Save typester/171032 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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