]> git.vpit.fr Git - perl/modules/Perl-Critic-Policy-Dynamic-NoIndirect.git/commitdiff
Don't compile the hook each time
authorVincent Pit <vince@profvince.com>
Mon, 3 Jan 2011 21:34:11 +0000 (22:34 +0100)
committerVincent Pit <vince@profvince.com>
Mon, 3 Jan 2011 21:34:11 +0000 (22:34 +0100)
lib/Perl/Critic/Policy/Dynamic/NoIndirect.pm

index 068ab88d1ff81018234934d13bea9d2f80c71c54..aab3ff6c7386c3dc050b9239793dfe410c543f7b 100644 (file)
@@ -57,11 +57,11 @@ sub violates_dynamic {
  $file =~ s/(?<!\\)((\\\\)*)"/$1\\"/g;
 
  my @errs;
+ my $hook = sub { push @errs, [ @_ ] };
+
  my $wrapper = <<" WRAPPER";
   return;
   package main;
-  my \$hook;
-  BEGIN { \$hook = sub { push \@errs, [ \@_ ] } }
   no strict;
   no warnings;
   no indirect hook => \$hook;