Async-Stream

 view release on metacpan or  search on metacpan

lib/Async/Stream/FromArray.pm  view on Meta::CPAN

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  );
   
  my $stream = Async::Stream::FromArray->new(@urls)
 
=cut
 
sub new {
        my $class = shift;
        my $items = \@_;
 
        return $class->SUPER::new(
                sub {
                        $_[0]->( @{$items} ? (shift @{$items}) : () );
                        return;
                }
        );
}
 
 
=head1 AUTHOR

lib/Async/Stream/Pushable.pm  view on Meta::CPAN

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Class method create stream which you can use that to push items to that.
 
  my $stream = Async::Stream::Pushable->new(@urls)
 
=cut
 
sub new {
        my $class = shift;
 
        my $self;
        $self = $class->SUPER::new(
                sub {
                        my ($return_cb) = @_;
 
                        if (@{$self->{_items}}) {
                                $return_cb->(shift @{ $self->{_items} });
                        } else {
                                if ($self->{_is_finalized}){
                                        $return_cb->();
                                }
                                else {



( run in 0.239 second using v1.01-cache-2.11-cpan-496ff517765 )