From: gfx Date: Mon, 16 Nov 2009 08:46:00 +0000 (+0900) Subject: Move Mouse::Object::new to PurePerl.pm X-Git-Tag: 0.40_06~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=af04626de226ce78ec19d583e86fce4c1df2267d;p=gitmo%2FMouse.git Move Mouse::Object::new to PurePerl.pm --- diff --git a/lib/Mouse/Object.pm b/lib/Mouse/Object.pm index 33a1ce7..7cc315a 100644 --- a/lib/Mouse/Object.pm +++ b/lib/Mouse/Object.pm @@ -1,28 +1,7 @@ package Mouse::Object; use Mouse::Util qw(does dump); # enables strict and warnings -sub _new { - my $class = shift; - - $class->meta->throw_error('Cannot call new() on an instance') if ref $class; - - my $args = $class->BUILDARGS(@_); - - my $meta = Mouse::Meta::Class->initialize($class); - my $self = $meta->new_object($args); - - # BUILDALL - if( $self->can('BUILD') ) { - for my $class (reverse $meta->linearized_isa) { - my $build = Mouse::Util::get_code_ref($class, 'BUILD') - || next; - - $self->$build($args); - } - } - - return $self; -} +sub new; sub DESTROY { my $self = shift; diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index e50b57a..8ff18ee 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -412,6 +412,29 @@ sub BUILDARGS { } } +sub new { + my $class = shift; + + $class->meta->throw_error('Cannot call new() on an instance') if ref $class; + + my $args = $class->BUILDARGS(@_); + + my $meta = Mouse::Meta::Class->initialize($class); + my $self = $meta->new_object($args); + + # BUILDALL + if( $self->can('BUILD') ) { + for my $class (reverse $meta->linearized_isa) { + my $build = Mouse::Util::get_code_ref($class, 'BUILD') + || next; + + $self->$build($args); + } + } + + return $self; +} + 1; __END__