Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: Paths::Graph use

by afoken (Parson)
on Aug 24, 2012 at 04:20 UTC ( #989428=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Paths::Graph use
in thread Paths::Graph use

Now your reading code can simply be:

my $x=join "",<FILE>; my %graph = eval $x;

Please don't use string-eval to read data files. CPAN has several data file readers that don't crash your program or erase your harddisk if the data file contains unexpected data. Think about JSON, YAML, or, if you have no better idea, XML. None of those formats is read as executable code.

And if you really can't avoid string-eval, at least use Safe in a "deny-almost-everything" configuration.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)


Comment on Re^4: Paths::Graph use
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989428]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (17)
As of 2014-07-24 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls