Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Re^2: perlcritic compliant way to eval?
in thread perlcritic compliant way to eval?

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,
-- Hauke D

Replies are listed 'Best First'.
Re^4: perlcritic compliant way to eval?
by KeighleHawk (Scribe) on Jul 22, 2016 at 15:41 UTC
    Yes, that is the description I read also, it the way it reads makes it sound like do does have advantages over eval so I am very interested in tracking down the issues I had with it. I might not get to it for this code though. I have a couple more weeks so might squeeze it in. I'll report back if I do.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2024-04-23 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found