in reply to Re: Code references as use() parameters
in thread Code references as use() parameters
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Code references as use() parameters
by BrowserUk (Patriarch) on Apr 09, 2003 at 17:29 UTC |