1CPS::Governor::Simple(3Upsme)r Contributed Perl DocumentaCtPiSo:n:Governor::Simple(3pm)
2
3
4
6 "CPS::Governor::Simple" - iterate immediately as fast as possible
7
9 use CPS qw( gkforeach );
10 use CPS::Governor::Simple;
11
12 my $gov = CPS::Governor::Simple->new;
13
14 gkforeach( $gov, [ 1 .. 10 ],
15 sub {
16 my ( $item, $knext ) = @_;
17
18 print "$item\n";
19 goto &$knext;
20 },
21 sub {},
22 );
23
25 This CPS::Governor allows the functions using it to run as fast as
26 possible. It invokes its continuations immediately using a tailcall, so
27 as not to let the stack grow arbitrarily.
28
29 Its constructor takes no special arguments, and it provides no other
30 methods beyond those of "CPS::Governor".
31
33 Paul Evans <leonerd@leonerd.org.uk>
34
35
36
37perl v5.38.0 2023-07-20 CPS::Governor::Simple(3pm)