Perrin Harkins wrote:
On Sat, 2005-08-20 at 19:44 +0200, Frank Maas wrote:package A::B::C; my %CFG = ( some_tag => some_config, ... } ... sub do_something { ... do_something_else( $CFG{some_tag} ); ... } ... 1;After reading much of this discussion I am beginning to wonder if I am creating closures?Your do_something() sub will keep a persistent value for %CFG here. If this is intended to be static data, that's not a problem. I would use an "our" here instead though for static data.(I must admit that the concept of closures is -for some reason- very hard for me to grasp)You're not the only one. Closures are my least favorite Perl feature because they're so easy to use by accident and so hard to fully understand. - Perrin
So, let's reverse this. I have a module that will be used in perl.I want all subs in the module to share the stagte of one variable...in my case @context.
I also want any changes to @context to only effect the current user/request under mod_perl.
What's the best approach? -=Chris
smime.p7s
Description: S/MIME Cryptographic Signature