The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Item for Async::Stream

VERSION

Version 0.05

SYNOPSIS

Creating and managing item for Async::Stream

  use Async::Stream::Item;

  my $stream_item = Async::Stream::Item->new($value, $next_item_cb);
                

SUBROUTINES/METHODS

new($val,$generator)

Constructor creates instance of class. Class method gets 2 arguments item's value and generator subroutine references to generate next item.

  my $i = 0;
  my $stream_item = Async::Stream::Item->new($i++, sub {
      my $return_cb = shift;
      if($i < 100){
                                $return_cb->($i++)
      } else {
                                $return_cb->()
      }
    });

val()

Method returns item's value.

  my $value = $stream_item->val;

next($next_callback);

Method returns next item in stream. Method gets callback to return next item.

  $stream_item->next(sub {
      my $next_stream_item = shift;
    });

AUTHOR

Kirill Sysoev, <k.sysoev at me.com>

BUGS

Please report any bugs or feature requests to https://github.com/pestkam/p5-Async-Stream/issues.

SUPPORT

You can find documentation for this module with the perldoc command.

  perldoc Async::Stream::Item

LICENSE AND COPYRIGHT

Copyright 2017 Kirill Sysoev.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0