good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^3: perlcritic compliant way to eval?by haukex (Archbishop) |
on Jul 22, 2016 at 11:44 UTC ( [id://1168351]=note: print w/replies, xml ) | Need Help?? |
Hi Robert, 'do' ... seemed to work at first for me but is acting wonky There are some differences between do and eval, maybe that's the problem? "do 'stat.pl'; is largely like eval `cat stat.pl`; except that it's more concise, runs no external processes, keeps track of the current filename for error messages, searches the @INC directories, and updates %INC if the file is found. ... It also differs in that code evaluated with do FILE cannot see lexicals in the enclosing scope; eval STRING does." Also do requires some more error checking to figure out what went wrong if the file doesn't compile/run, see do. Hope this helps,
In Section
Seekers of Perl Wisdom
|
|