http://www.perlmonks.org?node_id=28634


in reply to Re: Handling cascading defaults
in thread Handling cascading defaults

I would actually organize that slightly differently:
package Err; sub new { return bless {}, shift; } sub err { my $self = shift; my %args = @_; # Do something with %args here }
And then in other code you would do this:
$handler ||= new Err; # time passes &do_right_thing() or $handler->err(title=>'Oops',msg=>'something went +wrong');