go ahead... be a heretic | |
PerlMonks |
Re: Good practice for OO module defaultsby GrandFather (Saint) |
on Apr 08, 2019 at 09:50 UTC ( [id://1232283]=note: print w/replies, xml ) | Need Help?? |
Think about where someone who has never encountered the code before would most likely find and understand the default processing and defaults. To my mind having the strings in the construction code is a pretty reasonable way to do it. The code is clear, concise and easy to maintain without needing any additional explanation. If the strings are long and span multiple lines using HEREDOCs can make it easier to see how things hang together. For default handling defined or (//) is your friend.
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
In Section
Seekers of Perl Wisdom
|
|