aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2021-01-02 19:50:10 +1300
committerTom Ryder <tom@sanctum.geek.nz>2021-01-02 19:57:04 +1300
commit39bfdeb2b70a5a9368fe9bb311b66bf37dfb2623 (patch)
treef328860adfe3d28287ff9cf8a9c4705f17332ae6
parentMerge branch 'release/v0.22' (diff)
parentAdd perlcriticrc (diff)
downloadList-Breakdown-39bfdeb2b70a5a9368fe9bb311b66bf37dfb2623.tar.gz
List-Breakdown-39bfdeb2b70a5a9368fe9bb311b66bf37dfb2623.zip
Merge branch 'release/v0.23'v0.23
* release/v0.23: Add perlcriticrc Use prototype refs rather than literal values
-rw-r--r--Changes4
-rw-r--r--MANIFEST.SKIP5
-rw-r--r--Makefile.PL2
-rw-r--r--README.md (renamed from README.markdown)8
-rw-r--r--lib/List/Breakdown.pm18
-rw-r--r--perlcriticrc7
-rw-r--r--t/errors.t2
-rw-r--r--t/intervals.t2
-rw-r--r--t/monitoring.t2
-rw-r--r--t/records.t2
-rw-r--r--t/words.t2
11 files changed, 33 insertions, 21 deletions
diff --git a/Changes b/Changes
index 216bcb7..801575b 100644
--- a/Changes
+++ b/Changes
@@ -6,6 +6,10 @@ documented here anyway for comprehensiveness' sake. Entries with "No
important changes" are likely to be trivial things like documentation
fixes or Perl::Tidy runs.
+0.23 2021-01-02
+
+ - Internal refactoring for code quality
+
0.22 2018-05-30
- Adjust Exporter syntax
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
index dd6fd82..ac675da 100644
--- a/MANIFEST.SKIP
+++ b/MANIFEST.SKIP
@@ -1,9 +1,10 @@
-^\.git
^List-Breakdown-.*
^MANIFEST\.SKIP$
^MYMETA\.
^Makefile$
^Makefile\.old$
-^README\.markdown
+^README\.md
+^\.git
^blib
+^perlcriticrc$
^pm_to_blib$
diff --git a/Makefile.PL b/Makefile.PL
index f08bb4d..7df8f93 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -26,7 +26,7 @@ WriteMakefile(
'meta-spec' => { version => 2 },
provides => {
'List::Breakdown' => {
- version => '0.22',
+ version => '0.23',
file => 'lib/List/Breakdown.pm',
},
},
diff --git a/README.markdown b/README.md
index f0febff..c37d305 100644
--- a/README.markdown
+++ b/README.md
@@ -4,7 +4,7 @@ List::Breakdown - Build sublist structures matching conditions
# VERSION
-Version 0.22
+Version 0.23
# SYNOPSIS
@@ -44,15 +44,15 @@ This module assists you in making a _breakdown_ of a list, copying and
filtering its items into a structured bucket layout according to your
specifications. Think of it as a syntax for [`grep`](https://metacpan.org/pod/perlfunc#grep-BLOCK-LIST) that returns named and structured results from one list.
-It differs from the excellent [List::Categorize](https://metacpan.org/pod/List::Categorize) in the use
+It differs from the excellent [List::Categorize](https://metacpan.org/pod/List%3A%3ACategorize) in the use
of references to define 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.
If you want to divide or _partition_ your list so that each item can only
appear in one category, you may want either
-[List::MoreUtils](https://metacpan.org/pod/List::MoreUtils#Partitioning) or possibly
-[Set::Partition](https://metacpan.org/pod/Set::Partition) instead.
+[List::MoreUtils](https://metacpan.org/pod/List%3A%3AMoreUtils#Partitioning) or possibly
+[Set::Partition](https://metacpan.org/pod/Set%3A%3APartition) instead.
# SUBROUTINES/METHODS
diff --git a/lib/List/Breakdown.pm b/lib/List/Breakdown.pm
index 04aa4ce..2903aac 100644
--- a/lib/List/Breakdown.pm
+++ b/lib/List/Breakdown.pm
@@ -16,7 +16,7 @@ use base qw(Exporter); ## no critic (ProhibitUseBase)
our @EXPORT_OK = qw(breakdown);
# Specify package version
-our $VERSION = '0.22';
+our $VERSION = '0.23';
# Dispatch table of functions to handle different ref types for the spec
# hashref's values
@@ -24,16 +24,16 @@ my %types = (
# If it's a hash, apply breakdown() again as if it were another root-level
# spec
- HASH => sub {
+ ref {} => sub {
my $spec = shift;
return { breakdown( $spec, @_ ) };
},
# If it's an array, we're doing numeric bounds checking [a,b)
- ARRAY => sub {
+ ref [] => sub {
my $bounds = shift;
@{$bounds} == 2
- or croak 'ARRAY ref for bounds needs two items';
+ or croak 'arrayref for bounds needs two items';
return [
grep {
( not defined $bounds->[0] or $_ >= $bounds->[0] )
@@ -44,14 +44,14 @@ my %types = (
# If it's a subroutine, return a arrayref of all elements for which it
# returns true
- CODE => sub {
+ ref sub { } => sub {
my $sub = shift;
return [ grep { $sub->() } @_ ];
},
# If it's a regular expression, return an arrayref of all elements it
# matches
- Regexp => sub {
+ ref qr//msx => sub {
my $re = shift;
return [ grep { $_ =~ $re } @_ ];
},
@@ -63,8 +63,8 @@ sub breakdown {
my ( $spec, @items ) = @_;
# Check the spec is a hashref
- ref $spec eq 'HASH'
- or croak 'HASH ref expected for first argument';
+ ref $spec eq ref {}
+ or croak 'hashref expected for first argument';
# Start building a results hash
my %results;
@@ -103,7 +103,7 @@ List::Breakdown - Build sublist structures matching conditions
=head1 VERSION
-Version 0.22
+Version 0.23
=head1 SYNOPSIS
diff --git a/perlcriticrc b/perlcriticrc
new file mode 100644
index 0000000..db52151
--- /dev/null
+++ b/perlcriticrc
@@ -0,0 +1,7 @@
+severity = brutal
+[-Compatibility::PodMinimumVersion]
+[-Documentation::RequirePODUseEncodingUTF8]
+[-Editor::RequireEmacsFileVariables]
+[-ErrorHandling::RequireUseOfExceptions]
+[-ValuesAndExpressions::RequireConstantOnLeftSideOfEquality]
+[-Variables::ProhibitLocalVars]
diff --git a/t/errors.t b/t/errors.t
index b39d740..8cd2fc0 100644
--- a/t/errors.t
+++ b/t/errors.t
@@ -8,7 +8,7 @@ use Test::More tests => 7;
use List::Breakdown 'breakdown';
-our $VERSION = '0.22';
+our $VERSION = '0.23';
my @t = 1 .. 3;
diff --git a/t/intervals.t b/t/intervals.t
index 327b529..302607d 100644
--- a/t/intervals.t
+++ b/t/intervals.t
@@ -8,7 +8,7 @@ use Test::More tests => 1;
use List::Breakdown 'breakdown';
-our $VERSION = '0.22';
+our $VERSION = '0.23';
## no critic (ProhibitMagicNumbers,ProhibitLeadingZeros)
my @numbers = ( 1, 32, 3718.4, 0x56, 0777, 3.14, -5, 1.2e5 );
diff --git a/t/monitoring.t b/t/monitoring.t
index b7b6f71..67fd1bc 100644
--- a/t/monitoring.t
+++ b/t/monitoring.t
@@ -8,7 +8,7 @@ use Test::More tests => 1;
use List::Breakdown 'breakdown';
-our $VERSION = '0.22';
+our $VERSION = '0.23';
my @checks = (
{
diff --git a/t/records.t b/t/records.t
index 1ef408f..1f24dd1 100644
--- a/t/records.t
+++ b/t/records.t
@@ -8,7 +8,7 @@ use Test::More tests => 1;
use List::Breakdown 'breakdown';
-our $VERSION = '0.22';
+our $VERSION = '0.23';
my @records = (
"NEW CUSTOMER John O''Connor\r 2017-01-01",
diff --git a/t/words.t b/t/words.t
index 11e01f1..2bca87d 100644
--- a/t/words.t
+++ b/t/words.t
@@ -8,7 +8,7 @@ use Test::More tests => 1;
use List::Breakdown 'breakdown';
-our $VERSION = '0.22';
+our $VERSION = '0.23';
my @words = qw(foo bar baz quux wibble florb);
my $filters = {