MooX::ChainedAttributes - Make your attributes chainable.
package Foo; use Moo; use MooX::ChainedAttributes; has name => ( is => 'rw', chained => 1, ); has age => ( is => 'rw', ); chain('age'); sub who { my ($self) = @_; print "My name is " . $self->name() . "!\n"; } my $foo = Foo->new(); $foo->name('Fred')->who(); # My name is Fred!
This module exists for your method chaining enjoyment. It was originally developed in order to support the porting of MooseX::Attribute::Chained using classes to Moo.
In Moose you would write:
package Bar; use Moose; use MooseX::Attribute::Chained; has baz => ( is=>'rw', traits=>['Chained'] );
To port the above to Moo just change it to:
package Bar; use Moo; use MooX::ChainedAttributes; has baz => ( is=>'rw', chained=>1 );
Aran Clary Deltac <bluefeet@gmail.com>
Graham Knop <haarg@haarg.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install MooX::ChainedAttributes, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooX::ChainedAttributes
CPAN shell
perl -MCPAN -e shell install MooX::ChainedAttributes
For more information on module installation, please visit the detailed CPAN module installation guide.