MooseX::AttributeHelpers 0.11

[email protected] (Sartak)
Newsgroups perl.moose
Message-ID <[email protected]>
Hi again,

(Sorry, forgot to include this in the previous mail!)

MooseX::AttributeHelpers 0.11 has a great new features, thanks to
Jason May. You can easily curry in arguments for the created methods.

Here's a simplistic example.

package Class;
has 'foo' => (
    metaclass => 'Number',
    is => 'rw',
    curries => {
        set => {
            zero_foo => [ 0 ],
            one_foo => [ 1 ],
        },
        mul => {
            double_foo => [ 2 ],
            triple_foo => [ 3 ],
        },
        div => {
            oh_shit => [ 0 ],
        },
    },
);

Class->zero_foo; # start at 0
Class->one_foo; # set to 1
Class->triple_foo; # set to 3
Class->triple_foo; # set to 9
Class->halve_foo; # set to 4.5
Class->oh_shit; # explodes because 4.5 / 0 is an error :)

It's pretty nifty! Especially because you can now have multiple
curried methods of one type (see how I have two methods for "set" and
"mul").

Shawn M Moore

__END__

0.11 Thurs. Jun 26, 2008
    - add the ability to curry method providers (thanks to jasonmay)
    - Counter: add set and allow inc and dec to accept args
    - add Bool as an attribute helper (thanks to jasonmay)
    - bump all modules to version 0.11 for consistency (sartak)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.