NAME
B::Foreach::Iterator - Manipulates foreach iterators
VERSION
This document describes B::Foreach::Iterator version 0.07.
SYNOPSIS
use B::Foreach::Iterator;
foreach my $key(foo => 10, bar => 20, baz => 30){
printf "%s => %s\n", $key => iter->next;
}
DESCRIPTION
B::Foreach::Iterator
provides functions that manipulate foreach
iterators.
INTERFACE
Exported functions
- iter(?$label)
-
Finds a
foreach
iterator, and returns it. You can supply a $label if necessary.If no iterators are found, it dies.
Instance methods
- $iterator->next()
-
Increases $iterator and returns its value.
- $iter->peek()
-
Returns the value of the next iterator.
- $iter->is_last()
-
Returns whether the foreach loop iteration is last or not.
- $iter->label()
-
Returns the label of $iterator.
If $iterator has no labels, it returns
undef
.
DEPENDENCIES
Perl 5.8.8 or later, and a C compiler.
BUGS
No bugs have been reported.
Please report any bugs or feature requests to the author.
SEE ALSO
pp_hot.c for pp_iter()
.
cop.h for struct block_loop
and struct context
.
AUTHOR
Goro Fuji <gfuji(at)cpan.org>.
ACKNOWLEDGEMENTS
Thanks to Hans Dieter Pearcey(HDP) for his suggestions.
LICENSE AND COPYRIGHT
Copyright (c) 2009, Goro Fuji. Some rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.