Coro::Generator - Create generators using Coro


Coro-Generator documentation  | view source Contained in the Coro-Generator distribution.

Index


NAME

Top

Coro::Generator - Create generators using Coro

SYNOPSIS

Top

  use 5.10.0; # This module does NOT require 5.10, but 'say' does
  use strict;
  use Coro::Generator;

  my $even = generator {
    my $x = 0;
    while(1) {
      $x++; $x++;
      yield $x;
    }
  };

  for my $i (1..10) {
    say $even->();
  }

DESCRIPTION

Top

In the words of wikipedia, generators look like functions but act like iterators.

EXPORT

generator, yield

SEE ALSO

Top

Coro

AUTHOR

Top

Brock Wilcox, <awwaiid@thelackthereof.org>

COPYRIGHT AND LICENSE

Top


Coro-Generator documentation  | view source Contained in the Coro-Generator distribution.