Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Nested evals - are they evil? (not evil enough)

by grinder (Bishop)
on Jul 31, 2007 at 11:03 UTC ( #629796=note: print w/ replies, xml ) Need Help??


in reply to Nested evals - are they evil?

Consider

eval { my ($dev, $inode) = stat($dir) or die "stat $dir\n"; eval { opendir D, $dir or die "opendir $dir\n"; eval { my $e = readdir(D) or die "readdir $dir\n"; eval { open my $in, '<' $e or die "open $e\n"; # etc etc } } } }

Especially if there was lots of other code intertwined within those blocks, when sprinkled with lots of conditionals on, and assignments to, $@, to confuse the unwary. Now that's what I would call evil nested evals.

Your puny evilness cannot hope to compare with this evilness (which is what I was expecting to find when I read the title of this node). Your code is naught but exception handling, which is not so much evil as merely vile :)

• another intruder with the mooring in the heart of the Perl


Comment on Re: Nested evals - are they evil? (not evil enough)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2015-07-28 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (257 votes), past polls