Syntax-Keyword-Gather
view release on metacpan or search on metacpan
lib/Syntax/Keyword/Gather.pm view on Meta::CPAN
use Sub::Exporter::Progressive -setup => {
exports => [qw{ break gather gathered take }],
groups => {
default => [qw{ break gather gathered take }],
},
};
my %gatherers;
sub gather(&) {
croak "Useless use of 'gather' in void context" unless defined wantarray;
my ($code) = @_;
my $caller = caller;
local @_;
push @{$gatherers{$caller}}, bless \@_, 'Syntax::Keyword::Gather::MagicArrayRef';
die $@
if !eval{ &$code } && $@ && !UNIVERSAL::isa($@, 'Syntax::Keyword::Gather::Break');
return @{pop @{$gatherers{$caller}}} if wantarray;
return pop @{$gatherers{$caller}} if defined wantarray;
}
( run in 0.346 second using v1.01-cache-2.11-cpan-49f99fa48dc )