MoopsX::ListObjects - Use Moops with List::Objects::WithUtils
package My::App; use MoopsX::ListObjects; class Foo { has mylist => ( default => sub { array }, isa => ArrayObj ); has mydata => ( default => sub { +{} }, isa => HashObj, coerce => 1 ); method add_items (@items) { $self->mylist->push(@items) } method find_matches (Str $string) { $self->mylist->grep(sub { $_ eq $string }) } } my $foo = Foo->new; $foo->add_items(qw/ foo bar baz /); my $matches = $foo->find_matches( 'foo' );
Extends Toby Inkster's Moops sugary class building syntax with List::Objects::WithUtils objects.
Importing MoopsX::ListObjects is the same as importing Moops, but with all of the objects available from List::Objects::WithUtils, as well as the types and coercions from List::Objects::Types.
Moops
List::Objects::WithUtils
List::Objects::Types
List::Objects::WithUtils::Role::Array
List::Objects::WithUtils::Role::Hash
Jon Portnoy <avenj@cobaltirc.org>
To install MoopsX::ListObjects, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MoopsX::ListObjects
CPAN shell
perl -MCPAN -e shell install MoopsX::ListObjects
For more information on module installation, please visit the detailed CPAN module installation guide.