Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Accessing module variables

by karlgoethebier (Abbot)
on Apr 20, 2018 at 07:46 UTC ( [id://1213226]=note: print w/replies, xml ) Need Help??


in reply to Accessing module variables

It might be better to use a config file:

talexb.pl

#!/usr/bin/env perl use strict; use warnings; use Config::Tiny; use Data::Dump; my $config = Config::Tiny->read(q(talexb.cfg)); dd $config; __END__

talexb.cfg

[credentials] user = 'Joe'; password = 'Secret123'; url = 'www.example.com'; prefix = 'EX';

Quite easy and untested. If this is what you wanted. See also Config::Tiny.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^2: Accessing module variables
by talexb (Chancellor) on Apr 20, 2018 at 11:58 UTC

    Thanks for your contribution -- as usual, my situation is a bit more complicated.

    I have a master configuration file with a list of sites. Each entry has a name, whether they're enabled, and the name of the file that contains that last order number. From the name (Foo, in my original post), I'm able to find the module with the credentials. And, although I wasn't crazy about the idea, a database is starting to make sense (especially for the last order number), but I really like the low maintenance feel of just editing a text file, compared to fiddling with a database.

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found