From: gfx Date: Wed, 23 Sep 2009 06:05:48 +0000 (+0900) Subject: Checking in changes prior to tagging of version 0.33. Changelog diff is: X-Git-Tag: 0.33^0 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bc71de540020f1b2b75bafd69e2021c103e1c4e3;p=gitmo%2FMouse.git Checking in changes prior to tagging of version 0.33. Changelog diff is: diff --git a/Changes b/Changes --- diff --git a/.shipit b/.shipit index d0355ce..eed06f7 100644 --- a/.shipit +++ b/.shipit @@ -1,7 +1,7 @@ -# auto-generated shipit config file. -steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist - -git.tagpattern = %v -git.push_to = origin - -CheckChangeLog.files = Changes +# auto-generated shipit config file. +steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist + +git.tagpattern = %v +git.push_to = origin + +CheckChangeLog.files = Changes diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 0e3a586..6e208e7 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -4,7 +4,7 @@ use warnings; use 5.006; use base 'Exporter'; -our $VERSION = '0.32'; +our $VERSION = '0.33'; sub moose_version(){ 0.90 } # which Mouse is a subset of diff --git a/lib/Mouse/Meta/Method.pm b/lib/Mouse/Meta/Method.pm index 763e532..a64dce8 100755 --- a/lib/Mouse/Meta/Method.pm +++ b/lib/Mouse/Meta/Method.pm @@ -1,23 +1,23 @@ -package Mouse::Meta::Method; -use strict; -use warnings; - -use overload - '&{}' => 'body', - fallback => 1, -; - -sub new{ - my($class, %args) = @_; - - return bless \%args, $class; -} - -sub body { $_[0]->{body} } -sub name { $_[0]->{name} } -sub package{ $_[0]->{name} } - - -1; - -__END__ +package Mouse::Meta::Method; +use strict; +use warnings; + +use overload + '&{}' => 'body', + fallback => 1, +; + +sub new{ + my($class, %args) = @_; + + return bless \%args, $class; +} + +sub body { $_[0]->{body} } +sub name { $_[0]->{name} } +sub package{ $_[0]->{name} } + + +1; + +__END__ diff --git a/lib/Mouse/Meta/Method/Accessor.pm b/lib/Mouse/Meta/Method/Accessor.pm index 0fb563c..4d7e3a9 100755 --- a/lib/Mouse/Meta/Method/Accessor.pm +++ b/lib/Mouse/Meta/Method/Accessor.pm @@ -171,22 +171,22 @@ sub _install_handles { foreach my $handle_name (keys %handles) { my $method_to_call = $handles{$handle_name}; - my $code = sub { - my $instance = shift; - my $proxy = $instance->$reader(); - - my $error = !defined($proxy) ? ' is not defined' - : ref($proxy) && !blessed($proxy) ? qq{ is not an object (got '$proxy')} - : undef; + my $code = sub { + my $instance = shift; + my $proxy = $instance->$reader(); + + my $error = !defined($proxy) ? ' is not defined' + : ref($proxy) && !blessed($proxy) ? qq{ is not an object (got '$proxy')} + : undef; if ($error) { - $instance->meta->throw_error( - "Cannot delegate $handle_name to $method_to_call because " - . "the value of " - . $attribute->name + $instance->meta->throw_error( + "Cannot delegate $handle_name to $method_to_call because " + . "the value of " + . $attribute->name . $error - ); - } - $proxy->$method_to_call(@_); + ); + } + $proxy->$method_to_call(@_); }; $class->add_method($handle_name => $code); } diff --git a/lib/Mouse/Meta/Module.pm b/lib/Mouse/Meta/Module.pm index 712e5e1..be2c7f6 100755 --- a/lib/Mouse/Meta/Module.pm +++ b/lib/Mouse/Meta/Module.pm @@ -20,8 +20,8 @@ use Mouse::Util qw/get_code_info not_supported load_class/; sub initialize { my($class, $package_name, @args) = @_; - ($package_name && !ref($package_name)) - || $class->throw_error("You must pass a package name and it cannot be blessed"); + ($package_name && !ref($package_name)) + || $class->throw_error("You must pass a package name and it cannot be blessed"); return $METACLASS_CACHE{$package_name} ||= $class->_new(package => $package_name, @args); @@ -96,13 +96,13 @@ sub add_method { *{ $pkg . '::' . $name } = $code; } -sub _code_is_mine { # taken from Class::MOP::Class - my ( $self, $code ) = @_; - - my ( $code_package, $code_name ) = get_code_info($code); - - return $code_package && $code_package eq $self->name - || ( $code_package eq 'constant' && $code_name eq '__ANON__' ); +sub _code_is_mine { # taken from Class::MOP::Class + my ( $self, $code ) = @_; + + my ( $code_package, $code_name ) = get_code_info($code); + + return $code_package && $code_package eq $self->name + || ( $code_package eq 'constant' && $code_name eq '__ANON__' ); } sub has_method { @@ -132,10 +132,10 @@ sub get_method{ return undef; } -sub get_method_list { +sub get_method_list { my($self) = @_; - - return grep { $self->has_method($_) } keys %{ $self->namespace }; + + return grep { $self->has_method($_) } keys %{ $self->namespace }; } { @@ -185,10 +185,10 @@ sub get_method_list { # anonymous but immortal if(!$mortal){ - # something like Super::Class|Super::Class::2=Role|Role::1 - $cache_key = join '=' => ( - join('|', @{$options{superclasses} || []}), - join('|', sort @{$options{roles} || []}), + # something like Super::Class|Super::Class::2=Role|Role::1 + $cache_key = join '=' => ( + join('|', @{$options{superclasses} || []}), + join('|', sort @{$options{roles} || []}), ); return $IMMORTALS{$cache_key} if exists $IMMORTALS{$cache_key}; } @@ -282,7 +282,7 @@ sub throw_error{ my($class, $message, %args) = @_; local $Carp::CarpLevel = $Carp::CarpLevel + 1 + ($args{depth} || 0); - local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though + local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though if(exists $args{longmess} && !$args{longmess}){ # intentionaly longmess => 0 Carp::croak($message); diff --git a/lib/Mouse/Meta/Role.pm b/lib/Mouse/Meta/Role.pm index 4b5c26f..8b437ec 100644 --- a/lib/Mouse/Meta/Role.pm +++ b/lib/Mouse/Meta/Role.pm @@ -288,7 +288,7 @@ sub combine_apply { my $attr = $role->get_attribute($attr_name); my $c = $attr_provided{$attr_name}; if($c && $c != $attr){ - $class->throw_error("We have encountered an attribute conflict with '$attr_name' " + $class->throw_error("We have encountered an attribute conflict with '$attr_name' " . "during composition. This is fatal error and cannot be disambiguated.") } else{ @@ -301,8 +301,8 @@ sub combine_apply { my $override = $role->get_override_method_modifier($method_name); my $c = $override_provided{$method_name}; if($c && $c != $override){ - $class->throw_error( "We have encountered an 'override' method conflict with '$method_name' during " - . "composition (Two 'override' methods of the same name encountered). " + $class->throw_error( "We have encountered an 'override' method conflict with '$method_name' during " + . "composition (Two 'override' methods of the same name encountered). " . "This is fatal error.") } else{ @@ -382,7 +382,7 @@ sub add_override_method_modifier{ if($self->has_method($method_name)){ # This error happens in the override keyword or during role composition, # so I added a message, "A local method of ...", only for compatibility (gfx) - $self->throw_error("Cannot add an override of method '$method_name' " + $self->throw_error("Cannot add an override of method '$method_name' " . "because there is a local version of '$method_name'" . "(A local method of the same name as been found)"); } @@ -390,14 +390,14 @@ sub add_override_method_modifier{ $self->{override_method_modifiers}->{$method_name} = $method; } -sub has_override_method_modifier { - my ($self, $method_name) = @_; - return exists $self->{override_method_modifiers}->{$method_name}; -} - -sub get_override_method_modifier { - my ($self, $method_name) = @_; - return $self->{override_method_modifiers}->{$method_name}; +sub has_override_method_modifier { + my ($self, $method_name) = @_; + return exists $self->{override_method_modifiers}->{$method_name}; +} + +sub get_override_method_modifier { + my ($self, $method_name) = @_; + return $self->{override_method_modifiers}->{$method_name}; } sub get_method_modifier_list { diff --git a/lib/Mouse/Meta/Role/Method.pm b/lib/Mouse/Meta/Role/Method.pm index eb94651..1d3d0a0 100755 --- a/lib/Mouse/Meta/Role/Method.pm +++ b/lib/Mouse/Meta/Role/Method.pm @@ -1,10 +1,10 @@ -package Mouse::Meta::Role::Method; -use strict; -use warnings; - -use base qw(Mouse::Meta::Method); - -1; - -__END__ - +package Mouse::Meta::Role::Method; +use strict; +use warnings; + +use base qw(Mouse::Meta::Method); + +1; + +__END__ + diff --git a/lib/Mouse/Meta/TypeConstraint.pm b/lib/Mouse/Meta/TypeConstraint.pm index 916acc1..30b0f06 100644 --- a/lib/Mouse/Meta/TypeConstraint.pm +++ b/lib/Mouse/Meta/TypeConstraint.pm @@ -34,23 +34,23 @@ sub check { } sub validate { - my ($self, $value) = @_; - if ($self->{_compiled_type_constraint}->($value)) { - return undef; - } - else { - $self->get_message($value); - } + my ($self, $value) = @_; + if ($self->{_compiled_type_constraint}->($value)) { + return undef; + } + else { + $self->get_message($value); + } } -sub assert_valid { - my ($self, $value) = @_; - - my $error = $self->validate($value); - return 1 if ! defined $error; +sub assert_valid { + my ($self, $value) = @_; + + my $error = $self->validate($value); + return 1 if ! defined $error; - Carp::confess($error); -} + Carp::confess($error); +} sub message { diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 1e8d028..b51f7bc 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -32,12 +32,12 @@ sub find_meta{ } sub does_role{ - my ($class_or_obj, $role) = @_; - - my $meta = Mouse::Meta::Module::class_of($class_or_obj); - - return 0 unless defined $meta; - return 1 if $meta->does_role($role); + my ($class_or_obj, $role) = @_; + + my $meta = Mouse::Meta::Module::class_of($class_or_obj); + + return 0 unless defined $meta; + return 1 if $meta->does_role($role); return 0; } @@ -87,44 +87,44 @@ BEGIN { } { # taken from Sub::Identify - sub get_code_info($) { - my ($coderef) = @_; - ref($coderef) or return; + sub get_code_info($) { + my ($coderef) = @_; + ref($coderef) or return; - my $cv = B::svref_2object($coderef); + my $cv = B::svref_2object($coderef); $cv->isa('B::CV') or return; - my $gv = $cv->GV; - $gv->isa('B::GV') or return; - - return ($gv->STASH->NAME, $gv->NAME); - } + my $gv = $cv->GV; + $gv->isa('B::GV') or return; + + return ($gv->STASH->NAME, $gv->NAME); + } } # taken from Mouse::Util (0.90) { my %cache; - sub resolve_metaclass_alias { - my ( $type, $metaclass_name, %options ) = @_; - - my $cache_key = $type . q{ } . ( $options{trait} ? '-Trait' : '' ); + sub resolve_metaclass_alias { + my ( $type, $metaclass_name, %options ) = @_; + + my $cache_key = $type . q{ } . ( $options{trait} ? '-Trait' : '' ); + + return $cache{$cache_key}{$metaclass_name} ||= do{ - return $cache{$cache_key}{$metaclass_name} ||= do{ - my $possible_full_name = join '::', 'Mouse::Meta', $type, 'Custom', ($options{trait} ? 'Trait' : ()), $metaclass_name ; - my $loaded_class = load_first_existing_class( - $possible_full_name, - $metaclass_name - ); - - $loaded_class->can('register_implementation') - ? $loaded_class->register_implementation + my $loaded_class = load_first_existing_class( + $possible_full_name, + $metaclass_name + ); + + $loaded_class->can('register_implementation') + ? $loaded_class->register_implementation : $loaded_class; - }; + }; } } @@ -265,15 +265,15 @@ sub apply_all_roles { # taken from Moose::Util 0.90 sub english_list { - return $_[0] if @_ == 1; - - my @items = sort @_; - - return "$items[0] and $items[1]" if @items == 2; - - my $tail = pop @items; - - return join q{, }, @items, "and $tail"; + return $_[0] if @_ == 1; + + my @items = sort @_; + + return "$items[0] and $items[1]" if @items == 2; + + my $tail = pop @items; + + return join q{, }, @items, "and $tail"; } sub not_supported{