summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgs@consttype.org>2010-03-08 16:11:43 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2010-03-08 16:11:43 +0100
commit40a34d2a6241f2b5cf618cd77336a9a537c5ce2b (patch)
treef6f501546706b01d94052d62be008ba4e1ba1b7a /dist
parentab8e66c141d8d7d892995deba69405e747204cf0 (diff)
downloadperl-40a34d2a6241f2b5cf618cd77336a9a537c5ce2b.tar.gz
B::sub_generation is not available for perls < 5.8.9
Diffstat (limited to 'dist')
-rw-r--r--dist/Safe/Safe.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/dist/Safe/Safe.pm b/dist/Safe/Safe.pm
index e33598ea2a..cc872802b1 100644
--- a/dist/Safe/Safe.pm
+++ b/dist/Safe/Safe.pm
@@ -3,7 +3,6 @@ package Safe;
use 5.003_11;
use strict;
use Scalar::Util qw(reftype);
-use B qw(sub_generation);
$Safe::VERSION = "2.25";
@@ -32,6 +31,18 @@ BEGIN { eval q{
use Carp::Heavy;
} }
+use B ();
+BEGIN {
+ no strict 'refs';
+ if (defined &B::sub_generation) {
+ *sub_generation = \&B::sub_generation;
+ }
+ else {
+ # fake sub generation changing for perls < 5.8.9
+ my $sg; *sub_generation = sub { ++$sg };
+ }
+}
+
use Opcode 1.01, qw(
opset opset_to_ops opmask_add
empty_opset full_opset invert_opset verify_opset