From: Shawn M Moore Date: Tue, 10 Jun 2008 04:24:40 +0000 (+0000) Subject: Finish moving Mouse::Attribute and Mouse::Class into Mouse::Meta::* X-Git-Tag: 0.04~50 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=306290e864ac23e5f1692c8495b0c173081a1ebb;p=gitmo%2FMouse.git Finish moving Mouse::Attribute and Mouse::Class into Mouse::Meta::* --- diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 2dad7f7..dae207d 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -9,8 +9,8 @@ use Sub::Exporter; 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; @@ -19,7 +19,7 @@ do { my %exports = ( meta => sub { - my $meta = Mouse::Class->initialize($CALLER); + my $meta = Mouse::Meta::Class->initialize($CALLER); return sub { $meta }; }, @@ -37,7 +37,7 @@ do { $names = [$names] if !ref($names); for my $name (@$names) { - Mouse::Attribute->create($package, $name, @_); + Mouse::Meta::Attribute->create($package, $name, @_); } }; }, @@ -62,7 +62,7 @@ do { strict->import; warnings->import; - my $meta = Mouse::Class->initialize($CALLER); + my $meta = Mouse::Meta::Class->initialize($CALLER); $meta->superclasses('Mouse::Object') unless $meta->superclasses; @@ -149,7 +149,7 @@ Moose. =head1 INTERFACE -=head2 meta -> Mouse::Class +=head2 meta -> Mouse::Meta::Class Returns this class' metaclass instance. diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 6a8c888..2e626b0 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -1,5 +1,5 @@ #!/usr/bin/env perl -package Mouse::Attribute; +package Mouse::Meta::Attribute; use strict; use warnings; @@ -232,15 +232,15 @@ __END__ =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. diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index c43c12d..ea7c896 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -1,5 +1,5 @@ #!/usr/bin/env perl -package Mouse::Class; +package Mouse::Meta::Class; use strict; use warnings; @@ -60,18 +60,18 @@ __END__ =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 @@ -81,18 +81,19 @@ Returns the name of the owner class. 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 for the owner class. +Begins keeping track of the existing L 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 objects. +L objects. -=head2 get_attribute Name -> Mouse::Attribute | undef +=head2 get_attribute Name -> Mouse::Meta::Attribute | undef -Returns the L with the given name. +Returns the L with the given name. =head2 linearized_isa -> [ClassNames] diff --git a/t/100-meta-class.t b/t/100-meta-class.t index 66ffb9d..8e3ee31 100644 --- a/t/100-meta-class.t +++ b/t/100-meta-class.t @@ -16,7 +16,7 @@ do { }; 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"); @@ -26,7 +26,7 @@ is($meta, $meta2, "same metaclass instance"); 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; @@ -50,7 +50,7 @@ do { }; 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"); diff --git a/t/101-meta-attribute.t b/t/101-meta-attribute.t index 4cafd88..6986fd4 100644 --- a/t/101-meta-attribute.t +++ b/t/101-meta-attribute.t @@ -18,10 +18,10 @@ do { }; 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');