Allow $obj->new in pure Perl
[gitmo/Mouse.git] / lib / Mouse / PurePerl.pm
index ddb1f4a..fb1909f 100644 (file)
@@ -156,7 +156,7 @@ sub Str        {
 sub Ref        { ref($_[0]) }
 sub ScalarRef  {
     my($value) = @_;
-    return ref($value) eq 'SCALAR'
+    return ref($value) eq 'SCALAR' || ref($value) eq 'REF';
 }
 sub ArrayRef   { ref($_[0]) eq 'ARRAY'  }
 sub HashRef    { ref($_[0]) eq 'HASH'   }
@@ -729,13 +729,8 @@ 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);
-    return $meta->new_object($args);
+    my $args  = $class->BUILDARGS(@_);
+    return $class->meta->new_object($args);
 }
 
 sub DESTROY {
@@ -796,7 +791,7 @@ Mouse::PurePerl - A Mouse guts in pure Perl
 
 =head1 VERSION
 
-This document describes Mouse version 0.70
+This document describes Mouse version 0.71
 
 =head1 SEE ALSO