![]() |
|
more useful options | |
PerlMonks |
Re^2: What to test in a new moduleby swl (Parson) |
on Jul 07, 2023 at 02:50 UTC ( #11153305=note: print w/replies, xml ) | Need Help?? |
It's a case of TIMTOTWDI, and I have not looked at the original code, but two comments: No need for this: $self->{'error'} = '';. It'll be autovivified if needed. It will autovivify as undef if it is not assigned to before it is accessed. That could cause issues later on with other code. There's no need for a return; at the end of a sub if nothing's being returned (unless you intentionally are returning undef. It's safer to explicitly return as otherwise the value of the last expression is returned. FWIW, this is covered in PBP on p197 under Implicit Returns, with a follow-on under Returning Failure on p199 (although that also encourages the Contextual::Return module which I don't use).
In Section
Seekers of Perl Wisdom
|
|