The rule of thumb is to use a default which is defined. °
Using undef as default should be redundant and will force you to check @_ - if still possible (untested)
Sorry, your code is longish (aka TLDR), if I didn't get it right, please consider condensing it to the relevant part.
This question could be actually very relevant if there is a real use case! P5P is considering to drop the population of @_ when signatures are used.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) not
# Standard signature with optional second arg. sub sig_std ($what, $arg=undef) {
In reply to Re: Distinguish between missing and undefined arguments with subroutine signatures
by LanX
in thread Distinguish between missing and undefined arguments with subroutine signatures
by jo37
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |