bump version to 1.09
[gitmo/Moose.git] / lib / Moose / Meta / Attribute / Native / Trait / Code.pm
CommitLineData
952b939d 1package Moose::Meta::Attribute::Native::Trait::Code;
cdf3cae6 2use Moose::Role;
952b939d 3use Moose::Meta::Attribute::Native::MethodProvider::Code;
cdf3cae6 4
60f08160 5our $VERSION = '1.09';
cdf3cae6 6$VERSION = eval $VERSION;
7our $AUTHORITY = 'cpan:STEVAN';
8
952b939d 9with 'Moose::Meta::Attribute::Native::Trait';
cdf3cae6 10
11has method_provider => (
12 is => 'ro',
13 isa => 'ClassName',
14 predicate => 'has_method_provider',
952b939d 15 default => 'Moose::Meta::Attribute::Native::MethodProvider::Code',
cdf3cae6 16);
17
cdf3cae6 18sub _helper_type { 'CodeRef' }
19
20no Moose::Role;
21
221;
e8953f86 23
24=pod
25
26=head1 NAME
27
8b09d5c3 28Moose::Meta::Attribute::Native::Trait::Code - Helper trait for Code attributes
e8953f86 29
30=head1 SYNOPSIS
31
32 package Foo;
33 use Moose;
34
35 has 'callback' => (
36 traits => ['Code'],
37 is => 'ro',
38 isa => 'CodeRef',
39 default => sub { sub { print "called" } },
40 handles => {
41 call => 'execute',
42 },
43 );
44
45 my $foo = Foo->new;
46 $foo->call; # prints "called"
47
48
49=head1 DESCRIPTION
50
51This provides operations on coderef attributes.
52
53=head1 PROVIDED METHODS
54
55=over 4
56
57=item B<execute(@args)>
58
59Calls the coderef with the given args.
60
d9299060 61=item B<execute_method(@args)>
62
63Calls the coderef with the the instance as invocant and given args.
64
e8953f86 65=back
66
b86a4688 67=head1 METHODS
68
69=over 4
70
71=item B<meta>
72
73=item B<method_provider>
74
75=item B<has_method_provider>
76
77=back
78
e8953f86 79=head1 BUGS
80
d4048ef3 81See L<Moose/BUGS> for details on reporting bugs.
e8953f86 82
83=head1 AUTHOR
84
85 Florian Ragwitz <rafl@debian.org>
86
87=head1 COPYRIGHT AND LICENSE
88
89Copyright 2007-2009 by Infinity Interactive, Inc.
90
91L<http://www.iinteractive.com>
92
93This library is free software; you can redistribute it and/or modify
94it under the same terms as Perl itself.
95
96=cut