You can pass a reference to a sub, and let other code call that whenever you like...
use strict; use warnings; { my $subref = sub { print "Hey, Hey!\n"; }; Foo($subref); } exit 0; sub Foo { my $callback = shift; print "Foo started\n"; $callback->(); print "Foo is done\n"; }
In reply to Re: Let a module call a sub of the caller
by SuicideJunkie
in thread Let a module call a sub of the caller
by voj
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |