http://www.perlmonks.org?node_id=996616


in reply to Re: symbols, scope, and mod_perl
in thread symbols, scope, and mod_perl

Um, that sounds "fishy" :)

Each thread gets its own symbol table, they don't share

Replies are listed 'Best First'.
Re^3: symbols, scope, and mod_perl
by Anonymous Monk on Oct 01, 2012 at 10:58 UTC
    Furthermore each script running under registry gets its own namespace, ex
    ModPerl::ROOT::ModPerl::Registry::D_3a_ro_sham_bo_theEXAMPLEXPORTERtes +t::my_dirt_sneaky_object_reference
      You are right. To be more precise, I am actually allocating the object on thread symbol table, but under mod_perl objects in "main" threads functions are persistent between calls. So it gets messed on subsequent calls. To avoid this it is needed to use a lexical variable, that does not allocate on the symbol table. To achieve the same behavior as per cgi environment, I should manipulate what it is called "stack scratchpad", but I do not have such skills.

        Well, you really shouldn't be exporting this object if its not a singleton

        use EXAMPLE(); my $poop = EXAMPLE->new; $poop->my_example_method; print "mission accomplished\n";

        You are right. ...

        Are you saying you're using threads in your program?