X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FPerl%2FCritic%2FPolicy%2FDynamic%2FNoIndirect.pm;h=068ab88d1ff81018234934d13bea9d2f80c71c54;hb=6e8dbf3b02e4df3a7304b7acbe47037575fc952d;hp=1132c571bec2ef17a43e49c357b2914c71c84d80;hpb=192a2eab8d6e0ba5d0f021eb8339a59df18577e7;p=perl%2Fmodules%2FPerl-Critic-Policy-Dynamic-NoIndirect.git diff --git a/lib/Perl/Critic/Policy/Dynamic/NoIndirect.pm b/lib/Perl/Critic/Policy/Dynamic/NoIndirect.pm index 1132c57..068ab88 100644 --- a/lib/Perl/Critic/Policy/Dynamic/NoIndirect.pm +++ b/lib/Perl/Critic/Policy/Dynamic/NoIndirect.pm @@ -11,11 +11,11 @@ Perl::Critic::Policy::Dynamic::NoIndirect - Perl::Critic policy against indirect =head1 VERSION -Version 0.04 +Version 0.05 =cut -our $VERSION = '0.04'; +our $VERSION = '0.05'; =head1 DESCRIPTION @@ -58,24 +58,25 @@ sub violates_dynamic { my @errs; my $wrapper = <<" WRAPPER"; - { return; package main; - no indirect hook => sub { push \@errs, [ \@_ ] }; - { - ; + my \$hook; + BEGIN { \$hook = sub { push \@errs, [ \@_ ] } } + no strict; + no warnings; + no indirect hook => \$hook; + do { #line 1 "$file" $src } - } WRAPPER { local ($@, *_); eval $wrapper; ## no critic - if ($@) { + if (my $err = $@) { require Carp; - Carp::confess("Couldn't compile the source wrapper: $@"); + Carp::croak("Couldn't compile the source wrapper: $err"); } }