aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-04 10:33:36 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-04 10:33:36 +1300
commit7e33c613fcef7cdfe44b93bb7f6da2206f30d7ca (patch)
tree81caf9717513dc1666f29bb1dc9eb23000e963a4
parente857250bf4ecc47875433018b35f1a71120b3862 (diff)
downloadList-Breakdown-7e33c613fcef7cdfe44b93bb7f6da2206f30d7ca.tar.gz
Rename module to List::Breakdownv0.06
Not close to any other module on CPAN from what I can tell. Also bump version number.
-rw-r--r--MANIFEST2
-rw-r--r--Makefile.PL8
-rw-r--r--README6
-rw-r--r--README.markdown6
-rw-r--r--lib/List/Breakdown.pm (renamed from lib/List/Filters.pm)40
-rw-r--r--t/errors.t12
-rw-r--r--t/words.t6
7 files changed, 40 insertions, 40 deletions
diff --git a/MANIFEST b/MANIFEST
index 09eaf65..8c1f69a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,4 +1,4 @@
-lib/List/Filters.pm
+lib/List/Breakdown.pm
Makefile.PL
MANIFEST
README
diff --git a/Makefile.PL b/Makefile.PL
index 54aef50..f6edcf7 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,10 +4,10 @@ use warnings;
use ExtUtils::MakeMaker;
WriteMakefile(
- NAME => 'List::Filters',
+ NAME => 'List::Breakdown',
AUTHOR => 'Tom Ryder <tom@sanctum.geek.nz>',
- VERSION_FROM => 'lib/List/Filters.pm',
- ABSTRACT_FROM => 'lib/List/Filters.pm',
+ VERSION_FROM => 'lib/List/Breakdown.pm',
+ ABSTRACT_FROM => 'lib/List/Breakdown.pm',
LICENSE => 'artistic_2',
PL_FILES => {},
MIN_PERL_VERSION => '5.006',
@@ -19,5 +19,5 @@ WriteMakefile(
},
PREREQ_PM => {},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
- clean => { FILES => 'List-Filters-*' },
+ clean => { FILES => 'List-Breakdown-*' },
);
diff --git a/README b/README
index b52ef57..829ab1f 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
-List-Filters
+List-Breakdown
-Filters elements from a list non-uniquely into a specified hash
+Breakdown elements from a list non-uniquely into a specified hash
structure, which can be nested, that pass subroutines or match regular
expressions.
@@ -19,7 +19,7 @@ SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the
perldoc command.
- perldoc List::Filters
+ perldoc List::Breakdown
LICENSE AND COPYRIGHT
diff --git a/README.markdown b/README.markdown
index 6d5e8e4..b4cdd74 100644
--- a/README.markdown
+++ b/README.markdown
@@ -1,7 +1,7 @@
-List::Filters
+List::Breakdown
=============
-Filters elements from a list non-uniquely into a specified hash
+Filter elements from a list non-uniquely into a specified hash
structure, which can be nested, that pass subroutines or match regular
expressions.
@@ -22,7 +22,7 @@ Support and Documentation
After installing, you can find documentation for this module with the
perldoc command.
- perldoc List::Filters
+ perldoc List::Breakdown
License and Copyright
---------------------
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
diff --git a/t/errors.t b/t/errors.t
index 842c344..809b0b3 100644
--- a/t/errors.t
+++ b/t/errors.t
@@ -6,12 +6,12 @@ use utf8;
use Test::More tests => 4;
-use List::Filters 'filter';
+use List::Breakdown 'breakdown';
-our $VERSION = 0.05;
+our $VERSION = 0.06;
my @t = 1 .. 3;
-is( eval { filter { a => undef }, @t } || undef, undef, 'error_notref_undef' );
-is( eval { filter { a => 'a' }, @t } || undef, undef, 'error_notref_def' );
-is( eval { filter { a => [] }, @t } || undef, undef, 'error_badref_array' );
-is( eval { filter { a => \{} }, @t } || undef, undef, 'error_badref_double' );
+is( eval { breakdown { a => undef }, @t } || undef, undef, 'error_notref_undef' );
+is( eval { breakdown { a => 'a' }, @t } || undef, undef, 'error_notref_def' );
+is( eval { breakdown { a => [] }, @t } || undef, undef, 'error_badref_array' );
+is( eval { breakdown { a => \{} }, @t } || undef, undef, 'error_badref_double' );
diff --git a/t/words.t b/t/words.t
index a2ca767..609e2ff 100644
--- a/t/words.t
+++ b/t/words.t
@@ -6,9 +6,9 @@ use utf8;
use Test::More tests => 1;
-use List::Filters 'filter';
+use List::Breakdown 'breakdown';
-our $VERSION = 0.05;
+our $VERSION = 0.06;
my @words = qw(foo bar baz quux wibble florb);
my $filters = {
@@ -22,7 +22,7 @@ my $filters = {
},
has_ba => qr/ba/msx,
};
-my %filtered = filter $filters, @words;
+my %filtered = breakdown $filters, @words;
my %expected = (
all => [qw(foo bar baz quux wibble florb)],