sub default_themes { qw/dynamic maintenance/ }
sub applies_to { 'PPI::Document' }
+my $tag_obj = sub {
+ my $obj = '' . $_[0];
+ $obj = '{' if $obj =~ /^\s*\{/;
+ $obj;
+};
+
sub violates_dynamic {
my ($self, undef, $doc) = @_;
for (@errs) {
my ($obj, $meth, $line) = @$_[0, 1, 3];
$line -= $offset;
- my $tag = join "\0", $line, $meth, $obj;
+ my $tag = join "\0", $line, $meth, $tag_obj->($obj);
push @{$errs_tags{$tag}}, [ $obj, $meth ];
}
my $pos = $elt->location;
return 0 unless $pos;
- my $tag = join "\0", $pos->[0], $elt, $elt->snext_sibling;
+ my $tag = join "\0", $pos->[0], $elt, $tag_obj->($elt->snext_sibling);
if (my $errs = $errs_tags{$tag}) {
push @violations, do { my $e = pop @$errs; push @$e, $elt; $e };
delete $errs_tags{$tag} unless @$errs;
} @violations;
}
+=head1 CAVEATS
+
+The uses of the L<indirect> pragma inside the auditted code take precedence over this policy.
+Hence no violations will be reported for indirect method calls that are located inside the lexical scope of C<use indirect> or C<< no indirect hook => ... >>.
+Occurrences of C<no indirect> won't be a problem.
+
=head1 DEPENDENCIES
L<perl> 5.8, L<Carp>.