suppress warnings when we use around and has "+..."
[gitmo/Mouse.git] / lib / Mouse / Meta / Class.pm
index 90331ad..8668990 100644 (file)
@@ -63,6 +63,7 @@ sub add_method {
     my $pkg = $self->name;
 
     no strict 'refs';
+    no warnings 'redefine';
     $self->{'methods'}->{$name}++; # Moose stores meta object here.
     *{ $pkg . '::' . $name } = $code;
 }
@@ -208,12 +209,7 @@ sub does_role {
 }
 
 sub create {
-    my ( $class, @args ) = @_;
-
-    unshift @args, 'package' if @args % 2 == 1;
-
-    my (%options) = @args;
-    my $package_name = $options{package};
+    my ($self, $package_name, %options) = @_;
 
     (ref $options{superclasses} eq 'ARRAY')
         || confess "You must pass an ARRAY ref of superclasses"
@@ -228,9 +224,6 @@ sub create {
             if exists $options{methods};
 
     do {
-        # XXX should I implement Mouse::Meta::Module?
-        my $package_name = $options{package};
-
         ( defined $package_name && $package_name )
           || confess "You must pass a package name";
 
@@ -244,7 +237,7 @@ sub create {
         confess "creation of $package_name failed : $@" if $@;
     };
 
-    my (%initialize_options) = @args;
+    my %initialize_options = %options;
     delete @initialize_options{qw(
         package
         superclasses
@@ -253,11 +246,11 @@ sub create {
         version
         authority
     )};
-    my $meta = $class->initialize( $package_name => %initialize_options );
+    my $meta = $self->initialize( $package_name => %initialize_options );
 
     # FIXME totally lame
     $meta->add_method('meta' => sub {
-        $class->initialize(ref($_[0]) || $_[0]);
+        $self->initialize(ref($_[0]) || $_[0]);
     });
 
     $meta->superclasses(@{$options{superclasses}})
@@ -332,7 +325,7 @@ this class and its superclasses.
 Returns a mapping of attribute names to their corresponding
 L<Mouse::Meta::Attribute> objects.
 
-=head2 has_attribute Name -> Boool
+=head2 has_attribute Name -> Bool
 
 Returns whether we have a L<Mouse::Meta::Attribute> with the given name.