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

Re: A new idiom -or- I Hate Unless

by Zaxo (Archbishop)
on Aug 22, 2004 at 21:24 UTC ( [id://384973]=note: print w/replies, xml ) Need Help??


in reply to A new idiom -or- I Hate Unless

Both your reordering to place the meat of the statement first, and the use of the or operator in error conditions, are covered in perlstyle. You've chosen well, imo.

Perhaps you will get to a stage of maintainance that you can begin refactoring. Pasted blocks are a prime place to look when you do. A stock comment like '# Factor Fodder' or '# Pasted' will help identify them when that time comes.

Don't blame unless. It's a fine operator, just not the best choice for that statement.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: A new idiom -or- I Hate Unless
by erikharrison (Deacon) on Aug 22, 2004 at 21:32 UTC

    My problem is not so much unless as the problem it tries to fix - namely making doing something when a condition is false readable and clear. It does that, to an extent. But in 90% of the cases the code is for handling an error.

    Marking cut and paste code as such is a great idea. The code needs some documentation anyway. It's all uncommented.

    update: fixed typo
    Cheers,
    Erik

    Light a man a fire, he's warm for a day. Catch a man on fire, and he's warm for the rest of his life. - Terry Pratchet

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found