From: Graham Knop <haarg@haarg.org>
Date: Thu, 5 Feb 2015 09:49:44 +0000 (-0500)
Subject: avoid goto UNIVERSAL::VERSION on 5.6
X-Git-Tag: v1.999_002~5
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24590d987b3ff66dc1fe70c0d86f6ba4e5e5de21;p=p5sagit%2Fstrictures.git

avoid goto UNIVERSAL::VERSION on 5.6
---

diff --git a/lib/strictures.pm b/lib/strictures.pm
index a715c60..cff36fb 100644
--- a/lib/strictures.pm
+++ b/lib/strictures.pm
@@ -5,6 +5,7 @@ use warnings FATAL => 'all';
 
 BEGIN {
   *_PERL_LT_5_8_4 = ($] < 5.008004) ? sub(){1} : sub(){0};
+  *_CAN_GOTO_VERSION = ($] >= 5.008000) ? sub(){1} : sub(){0};
 }
 
 our $VERSION = '1.999_001';
@@ -83,14 +84,16 @@ our @WARNING_CATEGORIES = grep { exists $warnings::Offsets{$_} } qw(
 );
 
 sub VERSION {
-  no warnings;
-  local $@;
-  if (defined $_[1] && eval { $_[0]->UNIVERSAL::VERSION($_[1]); 1}) {
-    $^H |= 0x20000
-      unless _PERL_LT_5_8_4;
-    $^H{strictures_enable} = int $_[1];
+  {
+    no warnings;
+    local $@;
+    if (defined $_[1] && eval { &UNIVERSAL::VERSION; 1}) {
+      $^H |= 0x20000
+        unless _PERL_LT_5_8_4;
+      $^H{strictures_enable} = int $_[1];
+    }
   }
-  goto &UNIVERSAL::VERSION;
+  _CAN_GOTO_VERSION ? goto &UNIVERSAL::VERSION : &UNIVERSAL::VERSION;
 }
 
 our %extra_load_states;