AnyEvent-Capture

 view release on metacpan or  search on metacpan

lib/AnyEvent/Capture.pm  view on Meta::CPAN

}
use strict;
use warnings;
use AnyEvent ();
use Sub::Exporter -setup => {
    exports => [qw( capture )],
    groups => { default => [qw( capture )] },
};


sub capture(&) {
    my( $todo ) = @_;
    my $cv = AE::cv;
    my(@results) = $todo->( sub { $cv->send(@_) } );
    return $cv->recv;
}

1;


__END__



( run in 0.750 second using v1.01-cache-2.11-cpan-49f99fa48dc )