The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MooseX::MutatorAttributes - Moose Role to add a quick set method that returns self

VERSION

Version 0.12

SYNOPSIS

I got tired of doing this:

    $obj->attr1($value1);
    $obj->attr2($value2);
    $obj->method_that_uses_attr;

What I wanted to do was:

    with qw{MooseX::MutatorAttributes};
    $obj->set( attr1 => $value1, attr2 => $value2 )->method_that_uses_attr;

Now I can, and so can you.

METHOD

set

    $self->set( HASH );

Set takes a hash, keys are expected to be attributes, if they are not then we Carp::croak. If a key is an acceptable attribute then we attempt to set with $value.

set_only_rw_attr

    my $storage_href = {};
    $self->set_only_rw_attr($storage_href, HASH );

Set takes a hash, keys are expected to be attributes, but unlike set, we don't die. Instead we populate a given storage ref that was passed in. It's up to what to do with it. Post 'set' your $storage_href will hold all the non-writeable-attrs (either was not an attr or was 'ro').

If you wish to by-pass the storage part pass in an annon hashref {}.

AUTHOR

ben hengst, <notbenh at cpan.org>

BUGS

Please report any bugs or feature requests to bug-moosex-setter at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-MutatorAttributes. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc MooseX::MutatorAttributes

You can also look for information at:

ACKNOWLEDGEMENTS

This would not be possible with out stevan, mst, and everyone else who hangs out on #moose.

COPYRIGHT & LICENSE

Copyright 2008 ben hengst, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.