Barrie Slaymaker wrote:
> On Mon, Oct 22, 2001 at 10:46:04PM +0800, Stas Bekman wrote:
>
>>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
>>
>
> It should print "entered\n" twice, once when eval()ed, and a second time
> when handler() is called. But you're not calling handler() a second
> time, you've got a bearword "Foo::handler" there, not a sub call. Try
> adding some parens:
>
> Foo::Handler();
oops, my bad. so we need a special block which doesn't behave like a
block but still can be called. Is it possible to adjust the scope of the
code so when a compiler encounters a nested block/sub on the first
level, we tell it using some low level magic, that in fact it's on the
top level and not nested in the sub? something like this:
FLAT {
# the original script's code goes here
}
&FLAT;
and FLAT is a magic sub, which makes the code inside it call-able, but
at the same time this code doesn't know that it's inside a sub?
--
_____________________________________________________________________
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]