Is there a way to install the modules it uses "on demand"?
Here's what I've done in one script:
202 my @variables =
qw/User Password Url Prefix CommPlan ApiVersion/;
203 foreach my $site ( grep { $_->{'enabled'} == 1 }
@{$json_config} ) {
204
205 use lib '/some/path';
206 eval "use FOO::$site->{'module'}";
207
208 my %variables =
209 map { $_ => eval '$' .
join( '::', 'FOO', $site->{'module'}, $_ ) }
210 @variables;
This pulls in variables for each individual website, where the website credentials are stored in modules -- which are not stored in version control, obviously. I could also have put them in json files, but I liked the idea of using a module so that I could add dated comments to remember related information.
Alex / talexb / Toronto
Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.