Revision history for Perl extension Class-MOP.
+0.23
+ * Class::MOP::Class
+ - fixed the way attribute defaults are handled
+ during instance construction (bug found by chansen)
+
0.22 Mon. March 20, 2006
* Class::MOP::Class
- localized $@ in the *_package_variable functions
-Class::MOP version 0.22
+Class::MOP version 0.23
===========================
See the individual module documentation for more information
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
use base 'Class::MOP::Class';
exists ${$params{$current_class}}{$init_arg};
# if nothing was in the %params, we can use the
# attribute's default value (if it has one)
- $val ||= $attr->default($instance) if $attr->has_default();
+ if (!defined $val && $attr->has_default) {
+ $val = $attr->default($instance);
+ }
# now add this to the instance structure
$instance->{$current_class}->{$attr_name} = $val;
}
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
use Scalar::Util 'refaddr';
$val = $params{$init_arg} if exists $params{$init_arg};
# if nothing was in the %params, we can use the
# attribute's default value (if it has one)
- $val ||= $attr->default($instance) if $attr->has_default();
+ if (!defined $val && $attr->has_default) {
+ $val = $attr->default($instance);
+ }
# now add this to the instance structure
$class->get_package_variable('%' . $attr->name)->{ refaddr($instance) } = $val;
}
use Class::MOP::Attribute;
use Class::MOP::Method;
-our $VERSION = '0.22';
+our $VERSION = '0.23';
## ----------------------------------------------------------------------------
## Setting up our environment ...
use Sub::Name 'subname';
use B 'svref_2object';
-our $VERSION = '0.08';
+our $VERSION = '0.09';
# Self-introspection
$val = $params{$init_arg} if exists $params{$init_arg};
# if nothing was in the %params, we can use the
# attribute's default value (if it has one)
- $val ||= $attr->default($instance) if $attr->has_default();
+ if (!defined $val && $attr->has_default) {
+ $val = $attr->default($instance);
+ }
$instance->{$attr->name} = $val;
}
return $instance;