Hello List,

        I am using Data:Dumper in a script and am running into a problem with "use 
strict" and eval. Basically the conundrum is that the data I will be loading from the 
Data::Dumper file is going to be based off input to the final script, so it may not be 
the same for each run of the script. There will be many dumper files that have 
different variables. I cannot predeclare them for "use strict" since I won't know what 
they are until the eval.

        The only work around is to turn off use strict, but I would like to continue 
using it. Is there a way, either with Data:Dumper, or something else to get this to 
work?

        Here is the snippet of code and some source files, so if one is confused 
hopefully this will explain:

eval shift(@wholetemplatefile);         # define $datadumperfile.
eval shift(@wholetemplatefile);         # define $outfile.
shift(@wholetemplatefile);              # Get rid of the divider.

# Get the Data::Dumper information.
open (READ_DD, $datadumperfile);
while(<READ_DD>) {
  eval $_;
}
close(READ_DD);


        The error message and source files:

Global symbol "$Test01" requires explicit package name at (eval 3) line 1, <READ_DD> 
chunk 1.

>head -3 template.test.html 
$datadumperfile = "test.data";  # The file with the Data::Dumper database.
$outfile = "test.html";         # The final output file.
======== DATA BELOW HERE ========

>cat test.data
$Test01 = "Foo Baz";
>

Thanks,

=-= Robert Thompson

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to