Messages Just Work™ With Subclassing
package Your::Pirate::Point; use base 'Your::Point'; our $MESSAGES = { missing => "Avast! You be missin' ye old %s value. Arrrr!", };
Thus Spake Andy:
The only downside to the previous approach is that you're messing around
with the "original" $MESSAGES
hash. What if you want only some of your points
to have the new piratey error message, and others to have the default? Well
Badger makes that easy. Simply create a subclass of your original point
module and define a new set of $MESSAGES
in the subclass. Now Your::Pirate::Point
instances will use the new piratey messages without affecting the behaviour of
the base class Your::Point
class.