I think the problem is that you are taking a reference to the %default_values hash, instead of making a copy of it. Try this:
In general,my $self = ref($class) ? bless( +{ %default_values }, ref($class) +) : bless( +{ %default_values }, $class );
makes a (shallow) copy of %hash and returns a reference to the copy. (The leading + is not strictly necessary, but there are situations in which perl misconstrues the curlies as a block instead of an anonymous hash(ref) constructor, so I've gotten in the habit of disambiguating such expressions with a unary +.)+{ %hash }
Likewise,
makes a (shallow) copy of @array and returns a reference to the copy.[ @array ]
the lowliest monk
In reply to Re: Wrong Error Message When Testing for Failure of Constructor
by tlm
in thread Wrong Error Message When Testing for Failure of Constructor
by jkeenan1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |