Home  |  Linux  | Mysql  | PHP  | XML
From:Vance E. Neff Date:Wed Apr 22 20:04:57 2009
Subject:Global scope
Hi,

I'm trying to get some variables to be global in scope.

I have declared a bunch of variables that I want to be accessible
throughout my program.
I have a module options.pm defined as:
<pre>
package options;
use strict;
use base qw(Exporter);
our @EXPORT = qw(@BenefitsOptions %BenefitsOptions);
our @EXPORT_OK = qw();

our %BenefitsOptions = (
"Dental" => 1,
"Full" => 2,
"Base" => 3,
"Comm." => 4,
"END"
);
@BenefitsOptions = ();

1;
</pre>

and at the beginning of each of my CGI programs I have the line:
use options;

each program may access the variables defined in options.pm and may call
other .pm modules that also need to have access to those same options.pm
variables and those .pm modules might call another.pm modules that need
to access those same variables defined in options.pm.

I read the perlmod, perlobj, Exporter, perltoot and frankly, I'm now
more confused then ever.
I tried putting the variable declarations in a BEGIN block with no success.

I'm getting the error:
Global symbol "xx" requires explicit package name at module.pm line nn.

What is the best way to do this?

Vance

Navigate in group perl.beginners.cgi at sever nntp.perl.org
Previous Next


Your recent visits
Re: Global scope
Re: how to add support of Msql and CGI in Apache
Re: 2 off in array count and index
Re: Getting forward slashes and hyphins past the taint check
Perl CGI advise/feedback please ...



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants