note
educated_foo
This looks like a perfect place for the under-appreciated nonlocal loop control operators, e.g.:
<code>
@sources = (
{ pre => [sub { print 1; }, sub { print 2; last pre; }, sub { print 3 }],
post => [sub { print 4; }, sub { print 5; last source }] },
{ pre => [sub { print "badness" }] }
);
source: for (@sources) {
pre: for (@{$_->{pre}}) {
$_->();
}
post: for (@{$_->{post}}) {
$_->();
}
}
__END__
1
2
4
5
</code>
Document a good set of labels, and your module will be both convenient to use and educational about Perl's dark corners.
540365
540365