X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FRole%2FMethod%2FRequired.pm;h=7032b61ecc0aef0073dd4a2d30bbf0cc1cabbb3a;hb=8de5717850eb1f406e5f71d2ccfac33c72cc490b;hp=88182113e4dffbf59a5f5c68fb46e35be1b4c6b7;hpb=19fabdd362b0d39023e2359b59701c4fc42247de;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Role/Method/Required.pm b/lib/Moose/Meta/Role/Method/Required.pm index 8818211..7032b61 100644 --- a/lib/Moose/Meta/Role/Method/Required.pm +++ b/lib/Moose/Meta/Role/Method/Required.pm @@ -3,11 +3,26 @@ package Moose::Meta::Role::Method::Required; use strict; use warnings; +use metaclass; -our $VERSION = '0.52'; +use overload '""' => sub { shift->name }, # stringify to method name + fallback => 1; + +use base qw(Class::MOP::Object); + +our $VERSION = '0.92'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -use base 'Moose::Meta::Role::Method'; +# This is not a Moose::Meta::Role::Method because it has no implementation, it +# is just a name + +__PACKAGE__->meta->add_attribute('name' => ( + reader => 'name', + required => 1, +)); + +sub new { shift->_new(@_) } 1; @@ -21,9 +36,37 @@ Moose::Meta::Role::Method::Required - A Moose metaclass for required methods in =head1 DESCRIPTION +=head1 INHERITANCE + +C is a subclass of L. +It is B a subclass of C since it does not +provide an implementation of the method. + +=head1 METHODS + +=over 4 + +=item B<< Moose::Meta::Role::Method::Required->new(%options) >> + +This creates a new type constraint based on the provided C<%options>: + +=over 8 + +=item * name + +The method name. This is required. + +=back + +=item B<< $method->name >> + +Returns the required method's name, as provided to the constructor. + +=back + =head1 BUGS -All complex software has bugs lurking in it, and this module is no +All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT. @@ -33,7 +76,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2008 by Infinity Interactive, Inc. +Copyright 2006-2009 by Infinity Interactive, Inc. L