Collection::CategorizedCategorize and organize a collection of data | |
Download |
Collection::Categorized Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Jonathan Rockway
- Publisher web site:
- http://search.cpan.org/~jrockway/
Collection::Categorized Tags
Collection::Categorized Description
Categorize and organize a collection of data The idea is that, given a list of junk, you want to find order in the chaos. Write some categorizers (see below), dump your data in, and get it out in some sort of meaningful order. Collection::Categorized is a Perl module that can help you with that.SYNOPSIS use Collection::Categorized; # create a collection where elements are categorized by # the class they are in my $cc = Collection::Categorized->new( sub { ref $_ } ); # add some data $foo->{awesomeness} = 42; $cc->add($foo); # $foo isa Foo $cc->add($bar, $bar2); # $bars are Bars $cc->add(@bazs); # @bazs are Bazs # see what we have my @c = $cc->categories; # (Foo, Bar, Baz) # get the data by category my @foos = $cc->get('Foo'); # ($foo) my @bars = $cc->get('Bar'); # ($bar, $bar2) my @HOOO = $cc->get('HOOO'); # undef # grep the data $cc->edit(sub { grep { defined $_->{awesomeness} } @_ }); @foos = $cc->get('Foo'); # ($foo) @bars = $cc->get('Bar'); # () @HOOO = $cc->get('HOOO'); # undef Requirements: · Perl
Collection::Categorized Related Software