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