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.