1 package Moose::Meta::Attribute::Native::Trait::Code;
3 use Moose::Meta::Attribute::Native::MethodProvider::Code;
6 $VERSION = eval $VERSION;
7 our $AUTHORITY = 'cpan:STEVAN';
9 with 'Moose::Meta::Attribute::Native::Trait';
11 has method_provider => (
14 predicate => 'has_method_provider',
15 default => 'Moose::Meta::Attribute::Native::MethodProvider::Code',
18 sub _default_is { 'ro' }
19 sub _helper_type { 'CodeRef' }
29 Moose::Meta::Attribute::Native::Trait::Code - Helper trait for Code attributes
40 default => sub { sub { print "called" } },
47 $foo->call; # prints "called"
52 This provides operations on coderef attributes.
54 =head1 PROVIDED METHODS
58 =item B<execute(@args)>
60 Calls the coderef with the given args.
62 =item B<execute_method(@args)>
64 Calls the coderef with the the instance as invocant and given args.
74 =item B<method_provider>
76 =item B<has_method_provider>
82 See L<Moose/BUGS> for details on reporting bugs.
86 Florian Ragwitz <rafl@debian.org>
88 =head1 COPYRIGHT AND LICENSE
90 Copyright 2007-2009 by Infinity Interactive, Inc.
92 L<http://www.iinteractive.com>
94 This library is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself.