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
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.
So you need to delay the execution of the coderef until after compile-time unless you can force the compilation of the given sub.
HTH

_________
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

    Right. I brainfarted again.


    Examine what is said, not who speaks.
    1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
    2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
    3) Any sufficiently advanced technology is indistinguishable from magic.
    Arthur C. Clarke.