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