in reply to modules as data files
There is little difficulty, if you first think for the simple solution: call it with do() from ::main, and fetch as the return value the hash itself. At least the do() statement will in fact fetch something each and every time it is called,
but require() will only fetch it once only
####### Inside "test0.pm" ############################### return $data = { k0 => 'apple' , k1 => 'orange', }; ###### Inside the main program: ############################### use strict; use warnings; my $pmfile = shift @ARGV; my $pm = do "$pmfile" or die
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: modules as data files
by Anonymous Monk on Oct 10, 2005 at 19:02 UTC |
In Section
Seekers of Perl Wisdom