This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit fc24ec04e703168373d2054532652dea74d4be29
tree 3eeb10a155166903f095c383485ffacbfa48be2e
parent e85881a0af60ec32403f4118a79b07512c5bb185
tree 3eeb10a155166903f095c383485ffacbfa48be2e
parent e85881a0af60ec32403f4118a79b07512c5bb185
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Thu May 14 15:30:20 -0700 2009 | |
| |
MANIFEST | Thu May 14 15:30:20 -0700 2009 | |
| |
Makefile.PL | Thu May 14 15:30:20 -0700 2009 | |
| |
README | Fri May 15 03:35:06 -0700 2009 | |
| |
lib/ | Thu May 14 15:30:20 -0700 2009 | |
| |
t/ | Thu May 14 15:30:20 -0700 2009 |
README
MooseX::ChainedAccessors
Chained accessors on write operations for Moose.
INSTALLATION
To install this module, run the following commands:
perl ./Makefile.PL
make test
make install
USAGE
package MyClass;
use Moose;
has 'chained_attr' =>
(
traits => ['Chained'],
is => 'rw',
isa => 'Str',
);
sub my_method
{
my $self = shift;
print 'hello, ' . $self->chained_attr;
}
1;
MyClass->new->chained_attr('world')->my_method(); # hello, world!
Chained accessors also work with explicit 'reader/writer' accessors.
package MyClass;
use Moose;
has 'attr' =>
(
traits => ['Chained'],
is => 'rw',
isa => 'Str',
reader => 'get_attr',
writer => 'set_sttr',
);
sub my_method
{
my $self = shift;
print $self->get_attr;
}
1l
MyClass->new->set_attr('hello, world')->my_method(); # hello, world
Hopefully it's obvious why read operations can't be chained.
DOCUMENTATION
See http://search.cpan.org/dist/Moose/lib/Moose/Cookbook/Meta/Recipe3.pod for documentation on using traits.
And also http://www.dmclaughlin.com/2009/05/15/chained-accessors-in-moose/ for the release post.






