Move Mouse::Object::new to PurePerl.pm
[gitmo/Mouse.git] / lib / Mouse / Object.pm
index 5f09e0a..7cc315a 100644 (file)
@@ -1,42 +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 BUILDARGS {
-    my $class = shift;
-
-    if (scalar @_ == 1) {
-        (ref($_[0]) eq 'HASH')
-            || $class->meta->throw_error("Single parameters to new() must be a HASH ref");
-
-        return {%{$_[0]}};
-    }
-    else {
-        return {@_};
-    }
-}
+sub new;
 
 sub DESTROY {
     my $self = shift;