Perl Monk, Perl Meditation | |
PerlMonks |
return eval { die() } idiomby lestrrat (Deacon) |
on Aug 29, 2003 at 19:27 UTC ( [id://287805]=perlquestion: print w/replies, xml ) | Need Help?? |
lestrrat has asked for the wisdom of the Perl Monks concerning the following question: I'm in a dilemma here. At work, we have a lot of C programmers, and hence they like to code their Perl code in sort of a C-ish way. Which is fine in most cases, but there's one thing that I just fail to see the benefit, and that is an idiom that they use:
So basically they want to make it such that you can check the return value and check $@ in an errono-like fashion. Which is fine, but it just strikes me as really, really odd. I just fail to see how it could be better than just simply raising an exception. Why can't I just die()? If I'm to try and use a simple die/croak instead, I'm going to have to convince a lot of people... Otherwise if I'm going to have to live with it, I want to make sure that I understand the benefits, and that we're not alone in using this. In all honesty, I may just be too deep into all the Perl-isms, and that I'm missing something obvious. If there are other people who use this idiom, I would realy like to know, and also, why? What advantages do you gain? TIA.
Back to
Seekers of Perl Wisdom
|
|