From: Shawn M Moore Date: Wed, 11 Jun 2008 11:04:33 +0000 (+0000) Subject: Add has_attribute, rewrite Changes to be Moosier :) X-Git-Tag: 0.04~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=66eea168570f52254def2675f86706336ab9bd8a;p=gitmo%2FMouse.git Add has_attribute, rewrite Changes to be Moosier :) --- diff --git a/Changes b/Changes index 6d4e70b..4debfb4 100644 --- a/Changes +++ b/Changes @@ -1,14 +1,26 @@ Revision history for Mouse 0.03 - Add before/after/around, courtesy of Class::Method::Modifiers - Add support for ->new({...}) + * Mouse: + - Add before/after/around, courtesy of Class::Method::Modifiers -0.02 Wed Jun 11 01:56:44 2008 - Add Squirrel which acts as Moose if it's already loaded, otherwise - Mouse (thanks nothingmuch) - Fix the order in which BUILD methods are called (thanks Robert Boone) + * Mouse::Object: + - Add support for ->new({...}) + - Use compute_all_applicable_attributes in the constructor to get the + attributes of superclasses -0.01 Tue Jun 10 02:13:21 2008 - Initial release. + * Mouse::Meta::Class: + - More methods: compute_all_applicable_attributes, has_attribute + +0.02 Wed Jun 11 01:56:44 2008 + * Squirrel: + - Add Squirrel which acts as Moose if it's already loaded, otherwise + Mouse (thanks nothingmuch) + + * Mouse::Meta::Object: + - Fix the order in which BUILD methods are called (thanks Robert + Boone) + +0.01 Tue Jun 10 02:13:21 2008 + * Initial release. diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index 74082e4..42f824e 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -78,6 +78,7 @@ sub compute_all_applicable_attributes { } sub get_attribute_map { $_[0]->{attributes} } +sub has_attribute { exists $_[0]->{attributes}->{$_[1]} } sub get_attribute { $_[0]->{attributes}->{$_[1]} } sub linearized_isa { @{ mro::get_linear_isa($_[0]->name) } } @@ -124,6 +125,10 @@ this class and its superclasses. Returns a mapping of attribute names to their corresponding L objects. +=head2 has_attribute Name -> Boool + +Returns whether we have a L with the given name. + =head2 get_attribute Name -> Mouse::Meta::Attribute | undef Returns the L with the given name.