in reply to Best way to dynamically use a .pm?
Why put the data in .pm files? Can't it be controlled by data structures in some readable way, like JSON or YAML? Does it need to include code? If parameters in the config files can control program flow in the module, I'd say stick to config files and not dynamic modules. An alternative to JSON of YAML might be to look at any of the plethora of Config:: modules on CPAN.
Then there is the long forgotten support for files in the do keyword:
$ cat honda.pl #!perl print STDERR "Using Honda\n"; sub honda { print "Honda rulez\n"; } 1; $ perl -wE'do "honda.pl";say 2;honda()' Using Honda 2 Honda rulez $
do does accept variables :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Best way to dynamically use a .pm?
by TJPride (Pilgrim) on Nov 29, 2011 at 19:49 UTC |