Perl Monk, Perl Meditation | |
PerlMonks |
Re: A new idiom -or- I Hate Unlessby Juerd (Abbot) |
on Aug 23, 2004 at 09:09 UTC ( [id://385028]=note: print w/replies, xml ) | Need Help?? |
I agree. I always try to write error handlers using "or". Preferably with "or die", but "or do" isn't a problem. But it is certainly not now. I have been doing this for just over a year now, but I have copied it from someone else. In my style guide is: Error checking is done using or. This means open or do { ... } instead of unless (open) { ... } when handling the error is more than a simple statement. Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }
In Section
Meditations
|
|