foo
[gitmo/Moose.git] / lib / Moose / Object.pm
index a035523..fe407ea 100644 (file)
@@ -5,17 +5,23 @@ use strict;
 use warnings;
 
 use Moose::Meta::Class;
-use metaclass 'Moose::Meta::Class' => (
-       ':attribute_metaclass' => 'Moose::Meta::Attribute'
-);
+use metaclass 'Moose::Meta::Class';
 
 use Carp 'confess';
 
-our $VERSION = '0.04';
+our $VERSION = '0.05';
 
 sub new {
     my $class  = shift;
-    my %params = (scalar @_ == 1) ? %{$_[0]} : @_;
+    my %params;
+    if (scalar @_ == 1) {
+        (ref($_[0]) eq 'HASH')
+            || confess "Single parameters to new() must be a HASH ref";
+        %params = %{$_[0]};
+    }
+    else {
+        %params = @_;
+    }
        my $self = $class->meta->new_object(%params);
        $self->BUILDALL(\%params);
        return $self;
@@ -95,6 +101,9 @@ This will call every C<DEMOLISH> method in the inheritance hierarchy.
 
 =item B<does ($role_name)>
 
+This will check if the invocant's class C<does> a given C<$role_name>. 
+This is similar to C<isa> for object, but it checks the roles instead.
+
 =back
 
 =head1 BUGS