Shaw, Steven wrote:
A require will probably handle what you want, assuming you have proper scoping engaged, or are not 'strict'. Rather than handling this with Data::Dumper and mangling use/require, you might have a look at the Storable and Freezethaw modules from CPAN. They perform basically exactly what you are attempting, but are robust, proven, and don't have to be mainained by yourself ;-)....Hi I'm trying to use Perl as a configuration language. I have found Data::Dumper. I found some doco here:http://tit.irk.ru/perlbookshelf/advprog/ch10_02.htm#ch10-pgfId-976240 Here it talks about how to dump out complex data structures and mentions eval. What I don't understand is how to evaluate a file and access the result again. As a work-around, I am currently putting my configuration data into a .pm file and getting at it by using 'use'. Unfortunately you can't say $package = 'foo::configuration'; use $package; It's not legal. This means that this way doesn't seem the best. What I need is something like: $file = 'configuration.pl'; $result = evaluate_file($file); # FIXME foreach $item ($result) { # process configuration item }
I would give you links but http://search.cpan.org seems *very* cranky right now....
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]