summaryrefslogtreecommitdiff
path: root/lib/PPIx/XPath.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PPIx/XPath.pm')
-rw-r--r--lib/PPIx/XPath.pm23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/PPIx/XPath.pm b/lib/PPIx/XPath.pm
index 0873b07..05e8743 100644
--- a/lib/PPIx/XPath.pm
+++ b/lib/PPIx/XPath.pm
@@ -34,27 +34,30 @@ sub new {
# this collides with the axis specification of proper XPath.
# Here we change the "old-style" node names into the new names
{
-my $legacy_names_rx;my %new_name_for;
-sub clean_xpath_expr {
- my (undef,$expr)=@_;
+ my $legacy_names_rx;my %new_name_for;
+ sub clean_xpath_expr {
+ my (undef,$expr)=@_;
- $expr =~ s{$legacy_names_rx}{$new_name_for{$1}}ge;
+ $expr =~ s{$legacy_names_rx}{$new_name_for{$1}}ge;
- return $expr;
-}
+ return $expr;
+ }
my @PPI_Packs;
# taken from Devel::Symdump
my @packages=('PPI');
while (my $pack=shift(@packages)) {
- no strict 'refs';
- while (my ($key,$val)=each(%{*{"$pack\::"}})) {
+ my %pack_symbols = do {
+ no strict 'refs'; ## no critic(ProhibitNoStrict)
+ %{*{"$pack\::"}}
+ };
+ while (my ($key,$val)=each(%pack_symbols)) {
local *ENTRY=$val;
if (defined $val && defined *ENTRY{HASH} && $key=~/::$/
&& $key !~ /^::/
&& $key ne 'main::' && $key ne '<none>::') {
- my $p = "$pack\::$key";$p =~ s{::$}{}; #}{};
+ my $p = "$pack\::$key";$p =~ s{::$}{};
push @packages,$p;
$p =~ s{^PPI::}{};
@@ -68,7 +71,7 @@ sub clean_xpath_expr {
}
}
$legacy_names_rx='\b('.join('|',
- sort {length($b) <=> length($a)} @PPI_Packs
+ sort {length($b) <=> length($a)} @PPI_Packs
).')\b';
$legacy_names_rx=qr{$legacy_names_rx};
}