1Moose::Meta::Attribute:U:sNeartiCvoen:t:rTiMrboauoitstee:d:::CPMoeedrtela(:3D:)oActutmreinbtuattei:o:nNative::Trait::Code(3)
2
3
4
6 Moose::Meta::Attribute::Native::Trait::Code - Helper trait for CodeRef
7 attributes
8
10 version 2.2201
11
13 package Foo;
14 use Moose;
15
16 has 'callback' => (
17 traits => ['Code'],
18 is => 'ro',
19 isa => 'CodeRef',
20 default => sub {
21 sub { print "called" }
22 },
23 handles => {
24 call => 'execute',
25 },
26 );
27
28 my $foo = Foo->new;
29 $foo->call; # prints "called"
30
32 This trait provides native delegation methods for code references.
33
35 If you don't provide an "isa" value for your attribute, it will default
36 to "CodeRef".
37
39 • execute(@args)
40
41 Calls the coderef with the given args.
42
43 • execute_method(@args)
44
45 Calls the coderef with the instance as invocant and given args.
46
48 See "BUGS" in Moose for details on reporting bugs.
49
51 • Stevan Little <stevan@cpan.org>
52
53 • Dave Rolsky <autarch@urth.org>
54
55 • Jesse Luehrs <doy@cpan.org>
56
57 • Shawn M Moore <sartak@cpan.org>
58
59 • יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
60
61 • Karen Etheridge <ether@cpan.org>
62
63 • Florian Ragwitz <rafl@debian.org>
64
65 • Hans Dieter Pearcey <hdp@cpan.org>
66
67 • Chris Prather <chris@prather.org>
68
69 • Matt S Trout <mstrout@cpan.org>
70
72 This software is copyright (c) 2006 by Infinity Interactive, Inc.
73
74 This is free software; you can redistribute it and/or modify it under
75 the same terms as the Perl 5 programming language system itself.
76
77
78
79perl v5.34.0 Mo2o0s2e2:-:0M1e-t2a1::Attribute::Native::Trait::Code(3)