On Fri, 21 Sep 2001, Barrie Slaymaker wrote:
> On Tue, Sep 18, 2001 at 12:44:37AM +0800, Stas Bekman wrote:
> > Ken Williams wrote:
> >
> > > Stas Bekman <[EMAIL PROTECTED]> wrote:
> > >
> > >> On Sat, 8 Sep 2001, raptor wrote:
> > >>
> > >>> my $eval = join ( '', qq{
> > >>> package $package;
> > >>> my $request;
> > >>> START:
> > >>> use Apache qw(exit);
> > >>> $usercode
> > >>> sub handler {
> > >>> $package::request = \$r;
> > >>> goto START;
> > >>> };
> > >>> };
> > >>
> > >>
> > >> Hmm, that's an interesting idea. goto() can be very useful at times,
> > >> even if it's considered evil. Your solution seems to be too easy :)
> > >> Gotta go to sleep on it and see if there are some hidden issues with it.
>
> Any luck playing with this?
Not yet, got carried away with other stuff.
> I tried this a while ago on that weird experimental templating system I
> was nattering on about. Couldn't get it to work in 5.6.0 when compiling
> a package; START couldn't be found after the flow of control exited the
> program. I guess that the source code of the module gets disposed of,
> rendering START unreachable. Hopefully I missed a trick and y'all have
> it figured out...
It's quite possible that it doesn't work. But we can use then:
goto &NAME
The "goto-&NAME" form is quite different from the
other forms of "goto". In fact, it isn't a goto
in the normal sense at all, and doesn't have the
stigma associated with other gotos. Instead, it
substitutes a call to the named subroutine for the
currently running subroutine. This is used by
"AUTOLOAD" subroutines that wish to load another
subroutine and then pretend that the other subrou
tine had been called in the first place (except
that any modifications to @_ in the current sub
routine are propagated to the other subroutine.)
After the "goto", not even "caller" will be able
to tell that this routine was called first.
NAME needn't be the name of a subroutine; it can
be a scalar variable containing a code reference,
or a block which evaluates to a code reference.
which is even cooler :)
> P.S. A belated huge congrats on your ticketmaster.com gig. Wow. Too
> cool.
Thanks a lot, It's too cool indeed!
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]