Implement use strict 'subs' and 'refs'
authorJames E. Keenan <jkeenan@cpan.org>
Sat, 13 Mar 2010 17:41:29 +0000 (12:41 -0500)
committerSteffen Mueller <smueller@cpan.org>
Tue, 12 Jul 2011 18:53:50 +0000 (20:53 +0200)
With two understandable exceptions for use strict 'refs'.

dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm

index ec4969d..4433868 100644 (file)
@@ -1,4 +1,6 @@
 package ExtUtils::ParseXS;
+use strict 'subs';
+use strict 'refs';
 
 use 5.006;  # We use /??{}/ in regexes
 use Cwd;
@@ -460,7 +462,9 @@ EOF
 
     $_ = shift(@line);
     while (my $kwd = check_keyword("REQUIRE|PROTOTYPES|FALLBACK|VERSIONCHECK|INCLUDE(?:_COMMAND)?|SCOPE")) {
+      no strict 'refs';
       &{"${kwd}_handler"}();
+      use strict 'refs';
       next PARAGRAPH unless @line;
       $_ = shift(@line);
     }
@@ -971,8 +975,7 @@ EOF
     }
   }
 
-  if ($Overload) # make it findable with fetchmethod
-  {
+  if ($Overload) { # make it findable with fetchmethod
     print Q(<<"EOF");
 #XS(XS_${Packid}_nil); /* prototype to pass -Wmissing-prototypes */
 #XS(XS_${Packid}_nil)
@@ -1132,8 +1135,10 @@ sub process_keyword($) {
   my($pattern) = @_;
   my $kwd;
 
+  no strict 'refs';
   &{"${kwd}_handler"}()
     while $kwd = check_keyword($pattern);
+  use strict 'refs';
 }
 
 sub CASE_handler {