Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: Config file recommendations?

by Spidy (Chaplain)
on Mar 19, 2008 at 18:19 UTC ( #675050=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Config file recommendations?
in thread Config file recommendations?

This is what I've been trying, but it doesn't quite seem to work:

use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(%config); %config = ( foo => bar, baz => bat );

But I would still get the error Global symbol "%config" requires explicit package name. The code to use my config file was:

use config;


Comment on Re^4: Config file recommendations?
Select or Download Code
Re^5: Config file recommendations?
by kyle (Abbot) on Mar 19, 2008 at 21:18 UTC

    Main file:

    use strict; use warnings; use lib '.'; use MyConfig; use Data::Dumper; print Dumper \%config;

    MyConfig.pm:

    package MyConfig; use strict; use warnings; use Exporter; our @ISA = qw(Exporter); our %config; our @EXPORT = qw(%config); %config = ( foo => 'bar', baz => 'bat', ); 1;

    And the output:

    $VAR1 = { 'baz' => 'bat', 'foo' => 'bar' };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://675050]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2014-11-26 18:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (172 votes), past polls