in reply to (tye)Re: Inner Subroutines, mod_perl, and Segfaults
in thread Inner Subroutines, mod_perl, and Segfaults

So there's a difference between named subs and anonymous subs (closures)?

A named sub declared at any point in a package (even inside an eval()) gets installed into the symbol table.

I guess this test shows the difference, not that I'd do this in practice:

sub do_this { my $arg = shift; my $foo = "bar"; sub do_that { print "Arg is: $arg!\n"; print "Foo is: $foo!\n"; } } do_this(1); do_that();
We get the ever-popular "variable will not stay shared" message familiar to mod_perl hackers.

Thanks for the clarification.

Replies are listed 'Best First'.
Re: Re: (tye)Re: Inner Subroutines, mod_perl, and Segfaults
by tilly (Archbishop) on Jan 26, 2001 at 06:37 UTC
    Yes, there is a difference. I tried to explain the why's and wherefore's of it in RE (3): BrainPain-Help. (And yes, I am still looking for feedback on whether that explanation made sense to anyone...)