in reply to Inner Subroutines, mod_perl, and Segfaults

Um, sub declarations don't really nest. You could move the "sub cmpval" out from within the "sub getWorkspace" and the code would look more like how Perl actually interprets it.

Is that even close to what you are wondering about?

        - tye (but my friends call me "Tye")
  • Comment on (tye)Re: Inner Subroutines, mod_perl, and Segfaults

Replies are listed 'Best First'.
Re: (tye)Re: Inner Subroutines, mod_perl, and Segfaults
by chromatic (Archbishop) on Jan 25, 2001 at 23:53 UTC
    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.

      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...)