[VPM] FW: FW: overriding perl 'our','my' keywords

Peter Scott Peter at PSDT.com
Tue Mar 17 17:17:42 PDT 2009


At 04:18 PM 3/17/2009, Jer A wrote:
>I would like to use 'my', but I need 'our', because the I would like 
>to be able to modifiy the variable outside the static class, so I have 
>to use 'our' to make it public.

Typically a best practice is to make the class object-oriented and 
provide accessors for changing class variables, thus allowing them to 
be lexical:

my $class_foo;

sub set_foo { $class_foo = pop }

Only there are some helper modules to make this easier, inheritable, 
etc.  I'm getting into Moose these days and I like it, although I 
haven't used it with mod_perl.
-- 
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
http://www.perlmedic.com/




More information about the Victoria-pm mailing list