use Carp 'confess';
use Scalar::Util 'blessed';
-use Mouse::Attribute;
-use Mouse::Class;
+use Mouse::Meta::Attribute;
+use Mouse::Meta::Class;
use Mouse::Object;
use Mouse::TypeRegistry;
my %exports = (
meta => sub {
- my $meta = Mouse::Class->initialize($CALLER);
+ my $meta = Mouse::Meta::Class->initialize($CALLER);
return sub { $meta };
},
$names = [$names] if !ref($names);
for my $name (@$names) {
- Mouse::Attribute->create($package, $name, @_);
+ Mouse::Meta::Attribute->create($package, $name, @_);
}
};
},
strict->import;
warnings->import;
- my $meta = Mouse::Class->initialize($CALLER);
+ my $meta = Mouse::Meta::Class->initialize($CALLER);
$meta->superclasses('Mouse::Object')
unless $meta->superclasses;
=head1 INTERFACE
-=head2 meta -> Mouse::Class
+=head2 meta -> Mouse::Meta::Class
Returns this class' metaclass instance.
#!/usr/bin/env perl
-package Mouse::Attribute;
+package Mouse::Meta::Attribute;
use strict;
use warnings;
=head1 NAME
-Mouse::Attribute - attribute metaclass
+Mouse::Meta::Attribute - attribute metaclass
=head1 METHODS
-=head2 new %args -> Mouse::Attribute
+=head2 new %args -> Mouse::Meta::Attribute
-Instantiates a new Mouse::Attribute. Does nothing else.
+Instantiates a new Mouse::Meta::Attribute. Does nothing else.
-=head2 create OwnerClass, AttributeName, %args -> Mouse::Attribute
+=head2 create OwnerClass, AttributeName, %args -> Mouse::Meta::Attribute
Creates a new attribute in OwnerClass. Accessors and helper methods are
installed. Some error checking is done.
#!/usr/bin/env perl
-package Mouse::Class;
+package Mouse::Meta::Class;
use strict;
use warnings;
=head1 NAME
-Mouse::Class - hook into the Mouse MOP
+Mouse::Meta::Class - hook into the Mouse MOP
=head1 METHODS
-=head2 initialize ClassName -> Mouse::Class
+=head2 initialize ClassName -> Mouse::Meta::Class
-Finds or creates a Mouse::Class instance for the given ClassName. Only one
-instance should exist for a given class.
+Finds or creates a Mouse::Meta::Class instance for the given ClassName. Only
+one instance should exist for a given class.
-=head2 new %args -> Mouse::Class
+=head2 new %args -> Mouse::Meta::Class
-Creates a new Mouse::Class. Don't call this directly.
+Creates a new Mouse::Meta::Class. Don't call this directly.
=head2 name -> ClassName
Gets (or sets) the list of superclasses of the owner class.
-=head2 add_attribute Mouse::Attribute
+=head2 add_attribute Mouse::Meta::Attribute
-Begins keeping track of the existing L<Mouse::Attribute> for the owner class.
+Begins keeping track of the existing L<Mouse::Meta::Attribute> for the owner
+class.
-=head2 get_attribute_map -> { name => Mouse::Attribute }
+=head2 get_attribute_map -> { name => Mouse::Meta::Attribute }
Returns a mapping of attribute names to their corresponding
-L<Mouse::Attribute> objects.
+L<Mouse::Meta::Attribute> objects.
-=head2 get_attribute Name -> Mouse::Attribute | undef
+=head2 get_attribute Name -> Mouse::Meta::Attribute | undef
-Returns the L<Mouse::Attribute> with the given name.
+Returns the L<Mouse::Meta::Attribute> with the given name.
=head2 linearized_isa -> [ClassNames]
};
my $meta = Class->meta;
-isa_ok($meta, 'Mouse::Class');
+isa_ok($meta, 'Mouse::Meta::Class');
is_deeply([$meta->superclasses], ['Mouse::Object'], "correctly inherting from Mouse::Object");
can_ok($meta, 'name', 'get_attribute_map');
my $attr = $meta->get_attribute('pawn');
-isa_ok($attr, 'Mouse::Attribute');
+isa_ok($attr, 'Mouse::Meta::Attribute');
is($attr->name, 'pawn', 'got the correct attribute');
my $map = $meta->get_attribute_map;
};
my $child_meta = Child->meta;
-isa_ok($child_meta, 'Mouse::Class');
+isa_ok($child_meta, 'Mouse::Meta::Class');
isnt($meta, $child_meta, "different metaclass instances for the two classes");
};
my $meta = Class->meta;
-isa_ok($meta, 'Mouse::Class');
+isa_ok($meta, 'Mouse::Meta::Class');
my $attr = $meta->get_attribute('pawn');
-isa_ok($attr, 'Mouse::Attribute');
+isa_ok($attr, 'Mouse::Meta::Attribute');
can_ok($attr, qw(name class predicate clearer));
is($attr->name, 'pawn', 'attribute name');