Built several classes in OO perl that require the 'Exporter' to globalize common methods as a hashref for use within several classes.
MyStuff.pm
MyStuff/A.pm
MyStuff/B.pm
index.cgi accesses method from the A.pm and B.pm classes. MyStuff.pm is the base class accessed by the A.pm and B.pm. It contains the most common methods used by all modules. The variable $LIB is exported from the base class for use in the modules A.pm and B.pm.
$LIB contains methods of the base class
Example of method use (using $LIB) in A.pm
QUESTION:
Should I be worried about the use of $LIB being globalized under the MOD_PERL environment since all the modules are pre-compiled on Apache startup?
Thanks for your time..
MyStuff.pm
MyStuff/A.pm
MyStuff/B.pm
index.cgi accesses method from the A.pm and B.pm classes. MyStuff.pm is the base class accessed by the A.pm and B.pm. It contains the most common methods used by all modules. The variable $LIB is exported from the base class for use in the modules A.pm and B.pm.
$LIB contains methods of the base class
Example of method use (using $LIB) in A.pm
Code:
package A;
use vars qw($LIB);
use MyStuff qw($LIB);
sub new {
my $class = shift;
return bless({}, $class);
}
sub process_form {
my $self = shift;
my $title = $LIB->param_int('title'); # Return CGI input
# Do something like
my $select = "SELECT * FROM ..............."
my $data = $LIB->sql_hashref($select);
}
QUESTION:
Should I be worried about the use of $LIB being globalized under the MOD_PERL environment since all the modules are pre-compiled on Apache startup?
Thanks for your time..