Barrie Slaymaker wrote:
> On Mon, Oct 22, 2001 at 08:33:49AM -0000, [EMAIL PROTECTED] wrote:
>
>>
>> +- the closure issue:
>> + there was a suggestion from raptor to use goto() to leave the code
>> + unwrapped in the sub handler, which will solve the closure problem,
>> + but the problem is that once you leave a subroutine with goto() you
>> + cannot return, because you aren't in the sub anymore.
>>
>
> The issue I saw with this was that the top-level code outside the subs
> in a module is unreachable (I suspect it's freed, but have no clue)
> after the module exits. So, in something like
>
> package Foo ;
>
> enter:
> print "entered\n" ;
>
> sub handler { goto enter }
>
> 1 ;
>
> , by the time you can call handler(), the label "enter" is no longer
> reachable. I suspect it's because the top-level opcodes in a module are
> all freed after it is eval()ed.
It works for me:
my $package = << 'END';
package Foo ;
enter:
print "entered\n" ;
sub handler { goto enter }
1 ;
END
eval $package;
Foo::handler;
prints:
entered
The problem I see is not being able to do return(), since once I leave
the sub's scope with goto(), I cannot get back to complete 'return
Apache::OK'. Hmm, may be some XS black magic is possible here.
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]