Checking in changes prior to tagging of version 0.93. Changelog diff is:
[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
6d0815b5 5our $VERSION = '0.93';
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
18sub _default_is { 'ro' }
19sub _helper_type { 'CodeRef' }
20
21no Moose::Role;
22
231;
e8953f86 24
25=pod
26
27=head1 NAME
28
29Moose::Meta::Attribute::Native::Trait::Code
30
31=head1 SYNOPSIS
32
33 package Foo;
34 use Moose;
35
36 has 'callback' => (
37 traits => ['Code'],
38 is => 'ro',
39 isa => 'CodeRef',
40 default => sub { sub { print "called" } },
41 handles => {
42 call => 'execute',
43 },
44 );
45
46 my $foo = Foo->new;
47 $foo->call; # prints "called"
48
49
50=head1 DESCRIPTION
51
52This provides operations on coderef attributes.
53
54=head1 PROVIDED METHODS
55
56=over 4
57
58=item B<execute(@args)>
59
60Calls the coderef with the given args.
61
62=back
63
b86a4688 64=head1 METHODS
65
66=over 4
67
68=item B<meta>
69
70=item B<method_provider>
71
72=item B<has_method_provider>
73
74=back
75
e8953f86 76=head1 BUGS
77
78All complex software has bugs lurking in it, and this module is no
79exception. If you find a bug please either email me, or add the bug
80to cpan-RT.
81
82=head1 AUTHOR
83
84 Florian Ragwitz <rafl@debian.org>
85
86=head1 COPYRIGHT AND LICENSE
87
88Copyright 2007-2009 by Infinity Interactive, Inc.
89
90L<http://www.iinteractive.com>
91
92This library is free software; you can redistribute it and/or modify
93it under the same terms as Perl itself.
94
95=cut