in reply to Wrong Error Message When Testing for Failure of Constructor
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Wrong Error Message When Testing for Failure of Constructor
by jkeenan1 (Deacon) on Jul 22, 2005 at 17:39 UTC | |
by tlm (Prior) on Jul 22, 2005 at 18:52 UTC | |
by jkeenan1 (Deacon) on Jul 23, 2005 at 00:02 UTC | |
by tlm (Prior) on Jul 24, 2005 at 01:22 UTC | |
by jkeenan1 (Deacon) on Jul 24, 2005 at 01:40 UTC | |
by jkeenan1 (Deacon) on Jul 22, 2005 at 19:45 UTC |