From: gfx Date: Fri, 9 Oct 2009 04:00:43 +0000 (+0900) Subject: Tidy for release X-Git-Tag: 0.37_05~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=0126c27c413cb63f67e66e09b0fdfeb92117503a Tidy for release --- diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 03b77ed..a12c4a9 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -151,7 +151,6 @@ sub init_meta { 1; - __END__ =head1 NAME diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 211cd52..29046c0 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -338,10 +338,10 @@ sub get_parent_args { # DEPRECATED } -sub get_read_method { # DEPRECATED +sub get_read_method { $_[0]->{reader} || $_[0]->{accessor} } -sub get_write_method { # DEPRECATED +sub get_write_method { $_[0]->{writer} || $_[0]->{accessor} } diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index a33083a..ab75b2b 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -65,6 +65,7 @@ sub find_method_by_name{ my($self, $method_name) = @_; defined($method_name) or $self->throw_error('You must define a method name to find'); + foreach my $class( $self->linearized_isa ){ my $method = $self->initialize($class)->get_method($method_name); return $method if defined $method; @@ -143,7 +144,8 @@ sub add_attribute { } sub compute_all_applicable_attributes { - Carp::cluck('compute_all_applicable_attributes() has been deprecated'); + Carp::cluck('compute_all_applicable_attributes() has been deprecated') + if _MOUSE_VERBOSE; return shift->get_all_attributes(@_) } diff --git a/lib/Mouse/Meta/Method/Accessor.pm b/lib/Mouse/Meta/Method/Accessor.pm index c5faa54..9b2d92b 100755 --- a/lib/Mouse/Meta/Method/Accessor.pm +++ b/lib/Mouse/Meta/Method/Accessor.pm @@ -187,3 +187,4 @@ sub _generate_delegation{ 1; +__END__ diff --git a/lib/Mouse/Meta/Method/Constructor.pm b/lib/Mouse/Meta/Method/Constructor.pm index a7fd556..1d55a97 100644 --- a/lib/Mouse/Meta/Method/Constructor.pm +++ b/lib/Mouse/Meta/Method/Constructor.pm @@ -183,3 +183,4 @@ sub _generate_BUILDALL { } 1; +__END__ diff --git a/lib/Mouse/Meta/Method/Destructor.pm b/lib/Mouse/Meta/Method/Destructor.pm index 7775a14..66f4709 100644 --- a/lib/Mouse/Meta/Method/Destructor.pm +++ b/lib/Mouse/Meta/Method/Destructor.pm @@ -36,3 +36,4 @@ sub _generate_destructor{ } 1; +__END__ diff --git a/lib/Mouse/Meta/TypeConstraint.pm b/lib/Mouse/Meta/TypeConstraint.pm index 9ba41fe..190d853 100644 --- a/lib/Mouse/Meta/TypeConstraint.pm +++ b/lib/Mouse/Meta/TypeConstraint.pm @@ -18,13 +18,10 @@ sub new { my $check = delete $args{optimized}; if($args{_compiled_type_constraint}){ - Carp::cluck("'_compiled_type_constraint' has been deprecated, use 'optimized' instead"); - $check = $args{_compiled_type_constraint}; + Carp::cluck("'_compiled_type_constraint' has been deprecated, use 'optimized' instead") + if _MOUSE_VERBOSE; - if(blessed($check)){ - Carp::cluck("Constraint must be a CODE reference"); - $check = $check->{compiled_type_constraint}; - } + $check = $args{_compiled_type_constraint}; } if($check){ diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 4356daa..635fdd7 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -30,6 +30,8 @@ Mouse::Exporter->setup_import_methods( )], groups => { default => [], # export no functions by default + + # The ':meta' group is 'use metaclass' for Mouse meta => [qw(does meta dump _MOUSE_VERBOSE)], }, _export_to_main => 1, @@ -281,6 +283,7 @@ sub apply_all_roles { } my $role_name = $roles[-1][0]; load_class($role_name); + my $metarole = get_metaclass_by_name($role_name); ( $metarole && $metarole->isa('Mouse::Meta::Role') ) || $applicant->meta->throw_error("You can only consume roles, $role_name(".$role_name->meta.") is not a Mouse role");