]> git.vpit.fr Git - perl/modules/Perl-Critic-Policy-Dynamic-NoIndirect.git/blobdiff - lib/Perl/Critic/Policy/Dynamic/NoIndirect.pm
Remove trailing whitespace
[perl/modules/Perl-Critic-Policy-Dynamic-NoIndirect.git] / lib / Perl / Critic / Policy / Dynamic / NoIndirect.pm
index 4d4c4d2d6343e99bc562bd25fe8c4f18d22038d8..a727d0b1471fae40756e6c7a3f05cfda0a09d6b6 100644 (file)
@@ -11,11 +11,11 @@ Perl::Critic::Policy::Dynamic::NoIndirect - Perl::Critic policy against indirect
 
 =head1 VERSION
 
 
 =head1 VERSION
 
-Version 0.04
+Version 0.06
 
 =cut
 
 
 =cut
 
-our $VERSION = '0.04';
+our $VERSION = '0.06';
 
 =head1 DESCRIPTION
 
 
 =head1 DESCRIPTION
 
@@ -26,12 +26,12 @@ Since it wraps around L<indirect>, it needs to compile the audited code and as s
 
 =cut
 
 
 =cut
 
-use base qw/Perl::Critic::DynamicPolicy/;
+use base qw<Perl::Critic::DynamicPolicy>;
 
 
-use Perl::Critic::Utils qw/:severities/;
+use Perl::Critic::Utils qw<:severities>;
 
 sub default_severity { $SEVERITY_HIGH }
 
 sub default_severity { $SEVERITY_HIGH }
-sub default_themes   { qw/dynamic maintenance/ }
+sub default_themes   { qw<dynamic maintenance> }
 sub applies_to       { 'PPI::Document' }
 
 my $tag_obj = sub {
 sub applies_to       { 'PPI::Document' }
 
 my $tag_obj = sub {
@@ -57,25 +57,26 @@ sub violates_dynamic {
  $file =~ s/(?<!\\)((\\\\)*)"/$1\\"/g;
 
  my @errs;
  $file =~ s/(?<!\\)((\\\\)*)"/$1\\"/g;
 
  my @errs;
+ my $hook = sub { push @errs, [ @_ ] };
+
  my $wrapper = <<" WRAPPER";
  my $wrapper = <<" WRAPPER";
- {
   return;
   package main;
   return;
   package main;
-  no indirect hook => sub { push \@errs, [ \@_ ] };
-  {
-   ;
+  no strict;
+  no warnings;
+  no indirect hook => \$hook;
+  do {
 #line 1 "$file"
    $src
   }
 #line 1 "$file"
    $src
   }
- }
  WRAPPER
 
  {
   local ($@, *_);
   eval $wrapper; ## no critic
  WRAPPER
 
  {
   local ($@, *_);
   eval $wrapper; ## no critic
-  if ($@) {
+  if (my $err = $@) {
    require Carp;
    require Carp;
-   Carp::confess("Couldn't compile the source wrapper: $@");
+   Carp::croak("Couldn't compile the source wrapper: $err");
   }
  }
 
   }
  }
 
@@ -130,7 +131,7 @@ L<perl> 5.8, L<Carp>.
 
 L<Perl::Critic>, L<Perl::Critic::Dynamic>.
 
 
 L<Perl::Critic>, L<Perl::Critic::Dynamic>.
 
-L<indirect>.
+L<indirect> 0.20.
 
 =head1 SEE ALSO
 
 
 =head1 SEE ALSO
 
@@ -154,11 +155,11 @@ I will be notified, and then you'll automatically be notified of progress on you
 
 You can find documentation for this module with the perldoc command.
 
 
 You can find documentation for this module with the perldoc command.
 
-    perldoc Perl::Critic::Policy::Dynamic::NoIndirect 
+    perldoc Perl::Critic::Policy::Dynamic::NoIndirect
 
 =head1 COPYRIGHT & LICENSE
 
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2009,2010 Vincent Pit, all rights reserved.
+Copyright 2009,2010,2011 Vincent Pit, all rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
 
 
 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.