Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: OO design: returning string and/or special valueby 1nickt (Canon) |
on Oct 07, 2019 at 21:25 UTC ( [id://11107166]=note: print w/replies, xml ) | Need Help?? |
Hi, if you don't want to require the caller of your method to provide params (?!) you should just return all the data and let the caller consume the parts that are interesting. Return a hashref if the caller is another Perl routine, or a JSON obj if there's data interchange. Steer clear of wantarray and conditional/inconsistent return values in general. Hope this helps.
The way forward always starts with a minimal test.
In Section
Seekers of Perl Wisdom
|
|