Revision history for Mouse
+0.36 Sun Sep 27 16:53:06 2009
+ * Fix an issue that breaks backward compatibility (gfx)
+ - MouseX::Attribute does work, although make tests doesn't pass
+
0.35 Sat Sep 26 12:38:27 2009
* Work around Test::Exception 0.27_0x by including authorized ver. (gfx)
sub _process_options{
my($class, $name, $args) = @_;
+
+ # XXX: for backward compatibility (with method modifiers)
+ if($class->can('canonicalize_args') != \&canonicalize_args){
+ %{$args} = $class->canonicalize_args($name, %{$args});
+ }
+
# taken from Class::MOP::Attribute::new
defined($name)
|| $class->throw_error("You cannot have lazy attribute ($name) without specifying a default value for it");
}
- # XXX: for backward compatibility (with method modifiers)
- if($class->can('canonicalize_args') != \&canonicalize_args){
- %{$args} = $class->canonicalize_args($name, %{$args});
- }
return;
}
my ($self, $name, %args) = @_;
Carp::cluck("$self->canonicalize_args has been deprecated."
- . "Use \$self->_process_options instead.");
+ . "Use \$self->_process_options instead.")
+ if _MOUSE_VERBOSE;
return %args;
}
my ($self, $class, $name, %args) = @_;
Carp::cluck("$self->create has been deprecated."
- . "Use \$meta->add_attribute and \$attr->install_accessors instead.");
+ . "Use \$meta->add_attribute and \$attr->install_accessors instead.")
+ if _MOUSE_VERBOSE;
# noop
return $self;
my %args = ($self->get_parent_args($class, $name), @_);
Carp::cluck("$self->clone_parent has been deprecated."
- . "Use \$meta->add_attribute and \$attr->install_accessors instead.");
-
+ . "Use \$meta->add_attribute and \$attr->install_accessors instead.")
+ if _MOUSE_VERBOSE;
$self->clone_and_inherited_args($class, $name, %args);
}
$self->throw_error("Could not find an attribute by the name of '$name' to inherit from");
}
+sub associate_method{
+ my ($attribute, $method) = @_;
+ $attribute->{associated_methods}++;
+ return;
+}
+
sub install_accessors{
my($attribute) = @_;
use Scalar::Util qw/blessed weaken/;
-use Mouse::Util qw/get_linear_isa not_supported/;
+use Mouse::Util qw/:meta get_linear_isa not_supported/;
use Mouse::Meta::Method::Constructor;
use Mouse::Meta::Method::Destructor;
$self->{attributes}{$attr->name} = $attr;
$attr->install_accessors();
- if(!$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){
+ if(_MOUSE_VERBOSE && !$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){
Carp::cluck(qq{Attribute (}.$attr->name.qq{) of class }.$self->name.qq{ has no associated methods (did you mean to provide an "is" argument?)});
}
return $attr;
sub clone_instance {
my ($class, $instance, %params) = @_;
- Carp::cluck('clone_instance has been deprecated. Use clone_object instead');
+ Carp::cluck('clone_instance has been deprecated. Use clone_object instead')
+ if _MOUSE_VERBOSE;
return $class->clone_object($instance, %params);
}