Iterator::Breathe - Iterate a counter up and back
version 0.0201
use Iterator::Breathe; my $it = Iterator::Breathe->new( top => 255, bottom => -1, ); $it = Iterator::Breathe->new( top => 6.28, bottom => -3.14, step => 0.1, ); while ( 1 ) { $it->iterate; say $it->i; }
Iterator::Breathe increments and decrements an iterator value in a wave-like fashion.
Iterator::Breathe
$direction = $it->direction; $it->direction($dir);
Return or set the current value of direction.
direction
Default: 1 (1=up, 0=down)
1
$i = $it->i; $it->i($n);
Return or set the current value of i.
i
Default: 0
0
$bottom = $it->bottom; $it->bottom($x);
Return or set the current value of bottom.
bottom
$top = $it->top; $it->top($y);
Return or set the current value of top.
top
Default: 100
100
$step = $it->step; $it->step($z);
Return or set the current value of step.
step
Default: 1
$verbose = $it->verbose;
Show progress.
$it = Iterator::Breathe->new( %arguments );
Create a new Iterator::Breathe object.
$i = $it->iterate;
Moo
Scalar::Util
Gene Boggs <gene@cpan.org>
This software is Copyright (c) 2021 by Gene Boggs.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Iterator::Breathe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Iterator::Breathe
CPAN shell
perl -MCPAN -e shell install Iterator::Breathe
For more information on module installation, please visit the detailed CPAN module installation guide.