Add definition context to every accessor defined internally
[gitmo/Moose.git] / lib / Moose / Meta / Role / Method / Required.pm
CommitLineData
faa0f968 1
2package Moose::Meta::Role::Method::Required;
3
4use strict;
5use warnings;
2cf88ade 6use metaclass;
7
8use overload '""' => sub { shift->name }, # stringify to method name
9 fallback => 1;
10
11use base qw(Class::MOP::Object);
faa0f968 12
2cf88ade 13# This is not a Moose::Meta::Role::Method because it has no implementation, it
14# is just a name
15
2ee514b1 16__PACKAGE__->meta->add_attribute('name' => (
17 reader => 'name',
18 required => 1,
dc2b7cc8 19 Class::MOP::_definition_context(),
2ee514b1 20));
d67145ed 21
bc336e8e 22sub new { shift->_new(@_) }
23
faa0f968 241;
25
ad46f524 26# ABSTRACT: A Moose metaclass for required methods in Roles
27
faa0f968 28__END__
29
30=pod
31
faa0f968 32=head1 DESCRIPTION
33
d7a5a659 34=head1 INHERITANCE
35
36C<Moose::Meta::Role::Method::Required> is a subclass of L<Class::MOP::Object>.
37It is B<not> a subclass of C<Moose::Meta::Role::Method> since it does not
38provide an implementation of the method.
39
40=head1 METHODS
41
42=over 4
43
44=item B<< Moose::Meta::Role::Method::Required->new(%options) >>
45
46This creates a new type constraint based on the provided C<%options>:
47
48=over 8
49
50=item * name
51
52The method name. This is required.
53
54=back
55
56=item B<< $method->name >>
57
58Returns the required method's name, as provided to the constructor.
59
60=back
61
faa0f968 62=head1 BUGS
63
d4048ef3 64See L<Moose/BUGS> for details on reporting bugs.
faa0f968 65
07b0f1a5 66=cut