From: gfx Date: Tue, 17 Nov 2009 05:58:32 +0000 (+0900) Subject: Tidy X-Git-Tag: 0.40_07~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba153b332782dce8bf44fcc78ebb7230002b950c;p=gitmo%2FMouse.git Tidy --- diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index 99e0c6d..195cd32 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -154,15 +154,7 @@ sub compute_all_applicable_attributes { sub linearized_isa; -sub new_object { - my $self = shift; - my %args = (@_ == 1 ? %{$_[0]} : @_); - - my $object = bless {}, $self->name; - - $self->_initialize_object($object, \%args); - return $object; -} +sub new_object; sub clone_object { my $class = shift; diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index 470fbd7..ad1c624 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -223,6 +223,16 @@ sub get_all_attributes { return values %attrs; } +sub new_object { + my $self = shift; + my %args = (@_ == 1 ? %{$_[0]} : @_); + + my $object = bless {}, $self->name; + + $self->_initialize_object($object, \%args); + return $object; +} + sub _initialize_object{ my($self, $object, $args, $ignore_triggers) = @_; diff --git a/lib/Mouse/Util.pm b/lib/Mouse/Util.pm index 4d15fb2..34f6eee 100644 --- a/lib/Mouse/Util.pm +++ b/lib/Mouse/Util.pm @@ -1,6 +1,8 @@ package Mouse::Util; use Mouse::Exporter; # enables strict and warnings +sub get_linear_isa($;$); # must be here + BEGIN{ # Because Mouse::Util is loaded first in all the Mouse sub-modules, # XS loader is placed here, not in Mouse.pm. @@ -116,7 +118,7 @@ BEGIN { } else { # VVVVV CODE TAKEN FROM MRO::COMPAT VVVVV my $_get_linear_isa_dfs; # this recurses so it isn't pretty - $_get_linear_isa_dfs = sub { + $_get_linear_isa_dfs = sub ($;$){ no strict 'refs'; my $classname = shift; @@ -138,8 +140,6 @@ BEGIN { } } - - no warnings 'once'; *get_linear_isa = $get_linear_isa; } @@ -183,7 +183,7 @@ sub is_valid_class_name { return 0 if ref($class); return 0 unless defined($class); - return 1 if $class =~ /^\w+(?:::\w+)*$/; + return 1 if $class =~ /\A \w+ (?: :: \w+ )* \z/xms; return 0; } diff --git a/xs-src/Mouse.xs b/xs-src/Mouse.xs index 70366c8..f008333 100644 --- a/xs-src/Mouse.xs +++ b/xs-src/Mouse.xs @@ -483,7 +483,7 @@ PPCODE: } SV* -new_object_(SV* meta, ...) +new_object(SV* meta, ...) CODE: { AV* const xc = mouse_get_xc(aTHX_ meta); @@ -492,7 +492,8 @@ CODE: RETVAL = mouse_instance_create(aTHX_ MOUSE_xc_stash(xc)); mouse_class_initialize_object(aTHX_ meta, RETVAL, args, FALSE); } - +OUTPUT: + RETVAL void _initialize_object(SV* meta, SV* object, HV* args, bool ignore_triggers = FALSE)