Syntactic Confectionery Delight | |
PerlMonks |
Re^2: RFC: New style for argument check in subsby LanX (Saint) |
on Sep 05, 2012 at 11:41 UTC ( [id://991817]=note: print w/replies, xml ) | Need Help?? |
As I already said, accepting undef as valid argument is such a special and rare case that it should be covered by another approach. (see footnotes in OP) Here using ternaries is far more explicit and shows that a special argument undef is accepted. my $a = exists $arg{a} ? $arg{a} : 'else case'; But I agree that it's better to name the error die('Undefined argument!') instead of 'Missing argument' to avoid such misunderstandings.
Cheers Rolf
In Section
Meditations
|
|