Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

RE: RE: RE: "du" to hash

by merlyn (Sage)
on Jul 07, 2000 at 19:28 UTC ( [id://21505]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: "du" to hash
in thread "du" to hash

Two reasons to dislike the eval come to mind immediately:
  1. You are firing up the compiler over and over again to parse Perl code, when in fact the only part that is changing is the indicies and the depth of those. That means you're using a very general pile of code to handle a well-known predictable subset, and you'll burn far too much CPU to do that in the long run.
  2. More specifically here, you aren't escaping things like ` and { in the directory names, so you'll get invalid compilations from time to time, which you aren't checking for. These could also be potential security holes, since I merely have to create a directory with a name like `my-proggy` and you'll now be executing it! Shame.
I consider any use of runtime eval to be a red flag during a code review session. There really has to be no other way to do something, and let me tell you, there's almost always more than one better way to do it.

-- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2024-04-18 04:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found