stop using excludes within moose, since it's no longer necessary
[gitmo/Moose.git] / lib / Moose / Meta / Attribute / Native / Trait / Code.pm
CommitLineData
952b939d 1package Moose::Meta::Attribute::Native::Trait::Code;
cdf3cae6 2use Moose::Role;
cdf3cae6 3
fc6ef638 4with 'Moose::Meta::Attribute::Native::Trait';
cdf3cae6 5
cdf3cae6 6sub _helper_type { 'CodeRef' }
7
8no Moose::Role;
9
101;
e8953f86 11
e818d161 12# ABSTRACT: Helper trait for CodeRef attributes
13
14__END__
15
e8953f86 16=pod
17
e8953f86 18=head1 SYNOPSIS
19
20 package Foo;
21 use Moose;
22
23 has 'callback' => (
e132fd56 24 traits => ['Code'],
25 is => 'ro',
26 isa => 'CodeRef',
27 default => sub {
28 sub { print "called" }
29 },
30 handles => {
e8953f86 31 call => 'execute',
32 },
33 );
34
35 my $foo = Foo->new;
e132fd56 36 $foo->call; # prints "called"
e8953f86 37
38=head1 DESCRIPTION
39
7795e4de 40This trait provides native delegation methods for code references.
41
42=head1 DEFAULT TYPE
43
44If you don't provide an C<isa> value for your attribute, it will default to
45C<CodeRef>.
e8953f86 46
47=head1 PROVIDED METHODS
48
49=over 4
50
e132fd56 51=item * B<execute(@args)>
e8953f86 52
53Calls the coderef with the given args.
54
e132fd56 55=item * B<execute_method(@args)>
d9299060 56
57Calls the coderef with the the instance as invocant and given args.
58
e8953f86 59=back
60
61=head1 BUGS
62
d4048ef3 63See L<Moose/BUGS> for details on reporting bugs.
e8953f86 64
e8953f86 65=cut