CC: | |
Subject: | [Patch] Remove use of Perl::Critic::Utils::PPIRegexp. |
Date: | Wed, 20 Apr 2011 19:24:31 +0000 (GMT) |
To: | bug-perl-critic-bangs [...] rt.cpan.org |
From: | perl [...] galumph.com |
The attached patch replaces usage of P::C::Utils::PPIRegexp (which has been removed from the Perl-Critic distribution) with calls to native PPI methods. This allows P::C::Bangs to install when using perl 5.14.
diff -u -r Perl-Critic-Bangs-1.06-original/lib/Perl/Critic/Policy/Bangs/ProhibitUselessRegexModifiers.pm Perl-Critic-Bangs-1.06/lib/Perl/Critic/Policy/Bangs/ProhibitUselessRegexModifiers.pm
--- Perl-Critic-Bangs-1.06-original/lib/Perl/Critic/Policy/Bangs/ProhibitUselessRegexModifiers.pm 2010-05-23 00:58:50.000000000 -0500
+++ Perl-Critic-Bangs-1.06/lib/Perl/Critic/Policy/Bangs/ProhibitUselessRegexModifiers.pm 2011-04-20 14:04:31.105472021 -0500
@@ -5,7 +5,6 @@
use Readonly;
use Perl::Critic::Utils qw{ :severities :classification :ppi };
-use Perl::Critic::Utils::PPIRegexp qw{ &get_modifiers &get_match_string };
use base 'Perl::Critic::Policy';
our $VERSION = '1.06';
@@ -35,9 +34,9 @@
# 1) there's an 'm' modifier
# 2) the *only* thing in the regex is a compiled regex from a previous qr().
# 3) the modifiers are not the same in both places
- my %mods = get_modifiers($elem);
+ my %mods = $elem->get_modifiers();
if ( $mods{'m'} || $mods{'s'} ) {
- my $match = get_match_string( $elem );
+ my $match = $elem->get_match_string();
if ( $match =~ /^\$\w+$/smx ) { # It looks like a single variable in there
if ( my $qr = _previously_assigned_quote_like_operator( $elem, $match ) ) {
# don't violate if both regexes are modified in the same way
@@ -79,7 +78,7 @@
sub _sorted_modifiers {
my $elem = shift;
- my %mods = get_modifiers( $elem );
+ my %mods = $elem->get_modifiers();
return join( '', sort keys %mods );
}
diff -u -r Perl-Critic-Bangs-1.06-original/Makefile.PL Perl-Critic-Bangs-1.06/Makefile.PL
--- Perl-Critic-Bangs-1.06-original/Makefile.PL 2010-05-23 00:58:50.000000000 -0500
+++ Perl-Critic-Bangs-1.06/Makefile.PL 2011-04-20 13:58:16.804444732 -0500
@@ -11,9 +11,19 @@
ABSTRACT => 'Perl::Critic::Bangs - A collection of policies for Perl::Critic',
PL_FILES => {},
PREREQ_PM => {
- 'Perl::Critic' => 1.098,
- 'Test::Perl::Critic' => 1.01,
- 'Test::More' => 0,
+ 'Perl::Critic' => 1.098,
+ 'Perl::Critic::Policy', => 0,
+ 'Perl::Critic::PolicyFactory', => 0,
+ 'Perl::Critic::PolicyParameter', => 0,
+ 'Perl::Critic::TestUtils', => 0,
+ 'Perl::Critic::UserProfile', => 0,
+ 'Perl::Critic::Utils', => 0,
+ 'Perl::Critic::Violation', => 0,
+ 'PPI::Cache', => 0,
+ 'PPI::Document', => 0,
+ 'Readonly', => 0,
+ 'Test::More', => 0,
+ 'Test::Perl::Critic' => 1.01,
},
LICENSE => 'perl',