From e279cb0b1bca3fd51526cebcf39440049559cc98 Mon Sep 17 00:00:00 2001 From: Hugo van der Sanden Date: Thu, 10 Oct 2002 09:51:24 +0000 Subject: [PATCH] Remove use of caller() in strict.pm, and tighten Safe compartment for Storable tests to match. p4raw-id: //depot/perl@17986 --- ext/Storable/t/code.t | 2 +- lib/strict.pm | 6 +----- lib/strict.t | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/ext/Storable/t/code.t b/ext/Storable/t/code.t index 1912cd0..c8b2ca1 100644 --- a/ext/Storable/t/code.t +++ b/ext/Storable/t/code.t @@ -239,7 +239,7 @@ ok(prototype($thawed->[4]), prototype($obj[0]->[4])); { my $safe = new Safe; # because of opcodes used in "use strict": - $safe->permit(qw(:default require caller)); + $safe->permit(qw(:default require)); local $Storable::Eval = sub { $safe->reval(shift) }; $freezed = freeze $obj[0]->[1]; diff --git a/lib/strict.pm b/lib/strict.pm index 2eb756c..d1479ed 100644 --- a/lib/strict.pm +++ b/lib/strict.pm @@ -16,12 +16,8 @@ sub bits { $bits |= $bitmask{$s} || 0; } if (@wrong) { - my $useno = { - __PACKAGE__.'::import' => 'use', - __PACKAGE__.'::unimport' => 'no' - }->{ (caller(1))[3] }; require Carp; - Carp::croak("Don't know how to '$useno ".__PACKAGE__." qw(@wrong)'"); + Carp::croak("Unknown 'strict' tag(s) '@wrong'"); } $bits; } diff --git a/lib/strict.t b/lib/strict.t index a95b563..37bb4b3 100644 --- a/lib/strict.t +++ b/lib/strict.t @@ -100,17 +100,17 @@ for (@prgs){ } eval qq(use strict 'garbage'); -print +($@ =~ /^Don't know how to 'use strict qw\(garbage\)/) +print +($@ =~ /^Unknown 'strict' tag\(s\) 'garbage'/) ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@"; eval qq(no strict 'garbage'); -print +($@ =~ /^Don't know how to 'no strict qw\(garbage\)/) +print +($@ =~ /^Unknown 'strict' tag\(s\) 'garbage'/) ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@"; eval qq(use strict qw(foo bar)); -print +($@ =~ /^Don't know how to 'use strict qw\(foo bar\)/) +print +($@ =~ /^Unknown 'strict' tag\(s\) 'foo bar'/) ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@"; eval qq(no strict qw(foo bar)); -print +($@ =~ /^Don't know how to 'no strict qw\(foo bar\)/) +print +($@ =~ /^Unknown 'strict' tag\(s\) 'foo bar'/) ? "ok ".++$i."\n" : "not ok ".++$i."\t# $@"; -- 1.8.3.1