diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/List/Breakdown.pm (renamed from lib/List/Filters.pm) | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/List/Filters.pm b/lib/List/Breakdown.pm index f85e9b3..44efc58 100644 --- a/lib/List/Filters.pm +++ b/lib/List/Breakdown.pm @@ -1,4 +1,4 @@ -package List::Filters; +package List::Breakdown; # Force me to write this properly use strict; @@ -13,20 +13,20 @@ use Carp; # Handle exporting in a way Perl v5.6 should tolerate use base qw(Exporter); -our @EXPORT_OK = 'filter'; +our @EXPORT_OK = 'breakdown'; # Specify package version -our $VERSION = 0.05; +our $VERSION = 0.06; # Dispatch table of functions to handle different ref types for the spec # hashref's values my %types = ( - # If it's a hash, apply filter() again as if it were another root-level + # If it's a hash, apply breakdown() again as if it were another root-level # spec HASH => sub { my $spec = shift; - return { filter( $spec, @_ ) }; + return { breakdown( $spec, @_ ) }; }, # If it's a subroutine, return a arrayref of all elements for which it @@ -46,7 +46,7 @@ my %types = ( # Given a spec and a list of items, filter them into a hash of the same # structure -sub filter { +sub breakdown { my ( $spec, @items ) = @_; # Check the spec is a hashref @@ -85,24 +85,24 @@ sublists Unhandled tradename licensable MERCHANTABILITY =head1 NAME -List::Filters - Build list sublists matching conditions +List::Breakdown - Build list sublists matching conditions =head1 VERSION -Version 0.05 +Version 0.06 =head1 DESCRIPTION -This module filters elements from a list non-uniquely into a specified hash -structure, which can be nested. It may be useful in situations where you have a -big list of things to generate reports on or to otherwise filter into several -sublists. +This module "breaks down" a list--filtering elements from a list into a +specified hash structure, which can be nested. It may be useful in situations +where you have a big list of things to generate reports on or to otherwise +filter into several sublists. -It differs from the excellent C<List::Categorize> in that it does not require -only one final category for any given item; an item can be in more than one -filter. +It differs from the excellent C<List::Categorize> in the use of subroutine +references for each category and in not requiring only one final category for +any given item; an item can end up in the result set for more than one filter. -You could maybe think of it as a multi-C<grep> that returns named results. +You could maybe think of this as a multi-C<grep> that returns named results. =head1 SYNOPSIS @@ -118,11 +118,11 @@ You could maybe think of it as a multi-C<grep> that returns named results. }, has_ba => qr/ba/msx, }; - my %filtered = filter $cats, @words; + my %filtered = breakdown $cats, @words; =head1 SUBROUTINES/METHODS -=head2 B<filter(\%spec, @items)> +=head2 B<breakdown(\%spec, @items)> Given a hash reference structure and a list of items, apply each of the subroutines or regular expressions given as values of the hash reference, @@ -140,7 +140,7 @@ Tom Ryder C<< <tom@staff.inspire.net.nz> >> =item HASH reference expected for first argument -The first argument that B<filter()> saw wasn't the hash reference it expects. +The first argument that B<breakdown()> saw wasn't the hash reference it expects. That's the only format a spec is allowed to have. =item Reference expected for '%s' @@ -176,7 +176,7 @@ requests to C<tom@staff.inspire.net.nz>. You can find documentation for this module with the C<perldoc> command. - perldoc List::Filters + perldoc List::Breakdown =head1 LICENSE AND COPYRIGHT |