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