1MooseX::Attribute::ChaiUnseedr(3C)ontributed Perl DocumeMnotoasteiXo:n:Attribute::Chained(3)
2
3
4
6 MooseX::Attribute::Chained - Attribute that returns the instance to
7 allow for chaining
8
10 version 1.0.3
11
13 package Test;
14 use Moose;
15
16 has debug => (
17 traits => [ 'Chained' ],
18 is => 'rw',
19 isa => 'Bool',
20 );
21
22 sub complex_method
23 {
24 my $self = shift;
25
26 #...
27
28 print "helper message" if $self->debug;
29
30 #...
31 }
32
33
34 1;
35
36 Which allows for:
37
38 my $test = Test->new;
39 $test->debug(1)->complex_method;
40
41 $test->debug(1); # returns $test
42 $test->debug; # returns 1
43
45 MooseX::Attribute::Chained is a Moose Trait which allows for method
46 chaining on accessors by returning $self on write/set operations.
47
49 • Tom Hukins <tom@eborcom.com>
50
51 • Moritz Onken <onken@netcubed.de>
52
53 • David McLaughlin <david@dmclaughlin.com>
54
56 This software is copyright (c) 2017 by Tom Hukins.
57
58 This is free software; you can redistribute it and/or modify it under
59 the same terms as the Perl 5 programming language system itself.
60
62 Please report any bugs or feature requests on the bugtracker website
63 <http://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Attribute-Chained>
64 or by email to bug-moosex-attribute-chained at rt.cpan.org.
65
66 When submitting a bug or request, please include a test-file or a patch
67 to an existing test-file that illustrates the bug or desired feature.
68
69
70
71perl v5.34.0 2021-07-22 MooseX::Attribute::Chained(3)