1Class::Accessor::ChaineUds(e3r)Contributed Perl DocumentCaltaisosn::Accessor::Chained(3)
2
3
4
6 Class::Accessor::Chained - make chained accessors
7
9 package Foo;
10 use base qw( Class::Accessor::Chained );
11 __PACKAGE__->mk_accessors(qw( foo bar baz ));
12
13 my $foo = Foo->new->foo(1)->bar(2)->baz(4);
14 print $foo->bar; # prints 2
15
17 A chained accessor is one that always returns the object when called
18 with parameters (to set), and the value of the field when called with
19 no arguments.
20
21 This module subclasses Class::Accessor in order to provide the same
22 mk_accessors interface.
23
25 Richard Clamp <richardc@unixbeard.net>
26
28 Copyright (C) 2003 Richard Clamp. All Rights Reserved.
29
30 This module is free software; you can redistribute it and/or modify it
31 under the same terms as Perl itself.
32
34 Class::Accessor, Class::Accessor::Chained::Fast
35
36
37
38perl v5.38.0 2023-07-20 Class::Accessor::Chained(3)