Wouldn't a simple pre-declaration in a BEGIN block solve the problem?Nope as the sub still has to be parsed e.g
So you need to delay the execution of the coderef until after compile-time unless you can force the compilation of the given sub.BEGIN { foo(); } sub foo { BEGIN { sub foo } print "in foo()"; } __output__ Undefined subroutine &main::foo called at 249927.pl line 2. BEGIN failed--compilation aborted at 249927.pl line 3.
_________
broquaint
In reply to Re: Re: Code references as use() parameters
by broquaint
in thread Code references as use() parameters
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |