[Omaha.pm] Pulling in a hash via "exec"...FAIL

Dan Linder dan at linder.org
Thu Aug 7 06:37:29 PDT 2008


On Wed, Aug 6, 2008 at 8:47 PM, Jay Hannah <jay at jays.net> wrote:

> Have you tried this instead?
>
sub retrieve_fields {
>        my ( $file )=@_;
>        my *$fields*;
>        open(FILE, $file)
>        {
>                local $/;
>                eval <FILE>;
>        }
>        return *$fields*;
> }
>

I thought of that but I couldn't find an comments regarding the differences
caused by changing the hash (%fields) to a straight variable ($fields).  I
know Perl doesn't do strict casting of variables, but this still looked odd
to me.

I'll give it a shot and see - the main program  the retrieve_fields()
subroutine resides in is used by a number of other collection routines and I
don't want to break things too badly when adding my new section.  (Sadly we
don't have a test harness setup _yet_ so I don't have a baseline to work
from...)

Dan

-- 
"Quis custodiet ipsos custodes?" (Who can watch the watchmen?) -- from the
Satires of Juvenal
"I do not fear computers, I fear the lack of them." -- Isaac Asimov (Author)
** *** ***** ******* *********** *************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20080807/6777a828/attachment-0001.html>


More information about the Omaha-pm mailing list