in reply to Re: Using packages to store global configuration vars
in thread Using packages to store global configuration vars
I tried using Exporter as you described above (great example, thanks) but Apache/mod_perl kept complaining that :all wasn't being exported.
I gave up on this after a while and am trying to simply use our and call the vars with $Config::var. I'm getting the same error as before and there are no values associated with the variables. I added a print STDERR "database is $Config::database\n"; to demonstrate.
Snippet from Config.pm:
package Config.pm; use strict; ########################### # user options # ########################### our $database = 'data/site.db'; our $tmplfile = 'templates/index.html';
A couple snippets from index.cgi:
use strict; my $database = $Config::database; my $tmplfile = $Config::tmplfile; ... print STDERR "FOOBAR $Config::database\n"; my $template = HTML::Template->new(filename => $tmplfile, die_on_bad_p +arams => 0);
And the error:
FOOBAR [Sun Sep 6 05:30:35 2009] [error] PerlRun: `HTML::Template->new() cal +led with odd number of option pa rameters - should be of the form option => value at /blogapp/index.cgi + line 29\n'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Using packages to store global configuration vars
by dsheroh (Monsignor) on Sep 06, 2009 at 15:42 UTC | |
by fuzzyping (Chaplain) on Sep 06, 2009 at 18:09 UTC | |
|
Re^3: Using packages to store global configuration vars
by LanX (Saint) on Sep 06, 2009 at 18:43 UTC | |
by fuzzyping (Chaplain) on Sep 06, 2009 at 22:15 UTC | |
by LanX (Saint) on Sep 06, 2009 at 23:26 UTC |