summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Cromie <jcromie@cpan.org>2005-01-02 23:36:16 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-01-07 14:30:51 +0000
commit09e96b99c215ed417c37d0d188dd576c5464c72a (patch)
treef0311897e0c6eb6d473caa496bbc83165704599f
parent5df617be18e4372550725f3369e8e3fd641cce19 (diff)
downloadperl-09e96b99c215ed417c37d0d188dd576c5464c72a.tar.gz
Re: [PATCH] Remove Carp from warnings.pm
Message-ID: <cfe85dfa05010305367445dee6@mail.gmail.com> p4raw-id: //depot/perl@23768
-rw-r--r--MANIFEST1
-rw-r--r--ext/B/t/optree_specials.t196
-rwxr-xr-xext/B/t/stash.t4
-rw-r--r--lib/Carp.pm6
-rw-r--r--lib/English.pm4
-rw-r--r--lib/Exporter.pm5
-rw-r--r--lib/Exporter.t2
-rw-r--r--lib/Exporter/Heavy.pm3
-rw-r--r--lib/vars_carp.t16
-rw-r--r--lib/warnings.pm7
-rw-r--r--warnings.pl7
11 files changed, 114 insertions, 137 deletions
diff --git a/MANIFEST b/MANIFEST
index 841d99a0db..a334fc9246 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1997,6 +1997,7 @@ lib/utf8.t See if utf8 operations work
lib/validate.pl Perl library supporting wholesale file mode validation
lib/vars.pm Declare pseudo-imported global variables
lib/vars.t See if "use vars" works
+lib/vars_carp.t See if "use vars" doesn't load Carp.pm per default
lib/version.pm Support for version objects
lib/version.t Tests for version objects
lib/vmsish.pm Control VMS-specific behavior of Perl core
diff --git a/ext/B/t/optree_specials.t b/ext/B/t/optree_specials.t
index dda1adcc3d..67053c1a65 100644
--- a/ext/B/t/optree_specials.t
+++ b/ext/B/t/optree_specials.t
@@ -1,5 +1,12 @@
#!./perl
+# This tests the B:: module(s) with CHECK, BEGIN, END and INIT blocks. The
+# text excerpts below marked with "# " in front are the expected output. They
+# are there twice, EOT for threading, and EONT for a non-threading Perl. The
+# output is matched losely. If the match fails even though the "got" and
+# "expected" output look exactly the same, then watch for trailing, invisible
+# spaces.
+
BEGIN {
if ($ENV{PERL_CORE}){
chdir('t') if -d 't';
@@ -39,7 +46,6 @@ my $out = runperl(
my $src = q[our ($beg, $chk, $init, $end) = qq{'foo'}; BEGIN { $beg++ } CHECK { $chk++ } INIT { $init++ } END { $end++ }];
-
checkOptree ( name => 'BEGIN',
bcopts => 'BEGIN',
prog => $src,
@@ -47,74 +53,46 @@ checkOptree ( name => 'BEGIN',
# BEGIN 1:
# b <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->b
-# 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
+# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->2
# 3 <1> require sK/1 ->4
-# 2 <$> const[PV "strict.pm"] s/BARE ->3
-# 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
+# 2 <$> const[PV "warnings.pm"] s/BARE ->3
+# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->5
# - <@> lineseq K ->-
-# 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
+# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2 ->6
# a <1> entersub[t1] KS*/TARG,2 ->b
# 6 <0> pushmark s ->7
-# 7 <$> const[PV "strict"] sM ->8
-# 8 <$> const[PV "refs"] sM ->9
+# 7 <$> const[PV "warnings"] sM ->8
+# 8 <$> const[PV "qw"] sM ->9
# 9 <$> method_named[PVIV 1520340202] ->a
# BEGIN 2:
-# m <1> leavesub[1 ref] K/REFC,1 ->(end)
-# - <@> lineseq KP ->m
-# c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
-# e <1> require sK/1 ->f
-# d <$> const[PV "warnings.pm"] s/BARE ->e
-# f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
-# - <@> lineseq K ->-
-# g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
-# l <1> entersub[t1] KS*/TARG,2 ->m
-# h <0> pushmark s ->i
-# i <$> const[PV "warnings"] sM ->j
-# j <$> const[PV "qw"] sM ->k
-# k <$> method_named[PVIV 1520340202] ->l
-# BEGIN 3:
-# q <1> leavesub[1 ref] K/REFC,1 ->(end)
-# - <@> lineseq KP ->q
-# n <;> nextstate(main 2 -e:3) v ->o
-# p <1> postinc[t3] sK/1 ->q
-# - <1> ex-rv2sv sKRM/1 ->p
-# o <#> gvsv[*beg] s ->p
+# f <1> leavesub[1 ref] K/REFC,1 ->(end)
+# - <@> lineseq KP ->f
+# c <;> nextstate(main 2 -e:1) v ->d
+# e <1> postinc[t3] sK/1 ->f
+# - <1> ex-rv2sv sKRM/1 ->e
+# d <#> gvsv[*beg] s ->e
EOT_EOT
# BEGIN 1:
# b <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->b
-# 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->2
+# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->2
# 3 <1> require sK/1 ->4
-# 2 <$> const(PV "strict.pm") s/BARE ->3
-# 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2 ->5
+# 2 <$> const(PV "warnings.pm") s/BARE ->3
+# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2 ->5
# - <@> lineseq K ->-
-# 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2 ->6
+# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2 ->6
# a <1> entersub[t1] KS*/TARG,2 ->b
# 6 <0> pushmark s ->7
-# 7 <$> const(PV "strict") sM ->8
-# 8 <$> const(PV "refs") sM ->9
+# 7 <$> const(PV "warnings") sM ->8
+# 8 <$> const(PV "qw") sM ->9
# 9 <$> method_named(PVIV 1520340202) ->a
# BEGIN 2:
-# m <1> leavesub[1 ref] K/REFC,1 ->(end)
-# - <@> lineseq KP ->m
-# c <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->d
-# e <1> require sK/1 ->f
-# d <$> const(PV "warnings.pm") s/BARE ->e
-# f <;> nextstate(B::Concise -227 Concise.pm:327) v/2 ->g
-# - <@> lineseq K ->-
-# g <;> nextstate(B::Concise -227 Concise.pm:327) /2 ->h
-# l <1> entersub[t1] KS*/TARG,2 ->m
-# h <0> pushmark s ->i
-# i <$> const(PV "warnings") sM ->j
-# j <$> const(PV "qw") sM ->k
-# k <$> method_named(PVIV 1520340202) ->l
-# BEGIN 3:
-# q <1> leavesub[1 ref] K/REFC,1 ->(end)
-# - <@> lineseq KP ->q
-# n <;> nextstate(main 2 -e:3) v ->o
-# p <1> postinc[t2] sK/1 ->q
-# - <1> ex-rv2sv sKRM/1 ->p
-# o <$> gvsv(*beg) s ->p
+# f <1> leavesub[1 ref] K/REFC,1 ->(end)
+# - <@> lineseq KP ->f
+# c <;> nextstate(main 2 -e:1) v ->d
+# e <1> postinc[t2] sK/1 ->f
+# - <1> ex-rv2sv sKRM/1 ->e
+# d <$> gvsv(*beg) s ->e
EONT_EONT
@@ -191,92 +169,68 @@ checkOptree ( name => 'all of BEGIN END INIT CHECK -exec',
prog => $src,
expect => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
# BEGIN 1:
-# 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
-# 2 <$> const[PV "strict.pm"] s/BARE
+# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2
+# 2 <$> const[PV "warnings.pm"] s/BARE
# 3 <1> require sK/1
-# 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
-# 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
+# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2
+# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2
# 6 <0> pushmark s
-# 7 <$> const[PV "strict"] sM
-# 8 <$> const[PV "refs"] sM
+# 7 <$> const[PV "warnings"] sM
+# 8 <$> const[PV "qw"] sM
# 9 <$> method_named[PVIV 1520340202]
# a <1> entersub[t1] KS*/TARG,2
# b <1> leavesub[1 ref] K/REFC,1
# BEGIN 2:
-# c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
-# d <$> const[PV "warnings.pm"] s/BARE
-# e <1> require sK/1
-# f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
-# g <;> nextstate(B::Concise -227 Concise.pm:327) /2
-# h <0> pushmark s
-# i <$> const[PV "warnings"] sM
-# j <$> const[PV "qw"] sM
-# k <$> method_named[PVIV 1520340202]
-# l <1> entersub[t1] KS*/TARG,2
-# m <1> leavesub[1 ref] K/REFC,1
-# BEGIN 3:
-# n <;> nextstate(main 2 -e:3) v
-# o <#> gvsv[*beg] s
-# p <1> postinc[t3] sK/1
-# q <1> leavesub[1 ref] K/REFC,1
+# c <;> nextstate(main 2 -e:1) v
+# d <#> gvsv[*beg] s
+# e <1> postinc[t3] sK/1
+# f <1> leavesub[1 ref] K/REFC,1
# END 1:
-# r <;> nextstate(main 5 -e:6) v
-# s <#> gvsv[*end] s
-# t <1> postinc[t3] sK/1
-# u <1> leavesub[1 ref] K/REFC,1
+# g <;> nextstate(main 5 -e:1) v
+# h <#> gvsv[*end] s
+# i <1> postinc[t3] sK/1
+# j <1> leavesub[1 ref] K/REFC,1
# INIT 1:
-# v <;> nextstate(main 4 -e:5) v
-# w <#> gvsv[*init] s
-# x <1> postinc[t3] sK/1
-# y <1> leavesub[1 ref] K/REFC,1
+# k <;> nextstate(main 4 -e:1) v
+# l <#> gvsv[*init] s
+# m <1> postinc[t3] sK/1
+# n <1> leavesub[1 ref] K/REFC,1
# CHECK 1:
-# z <;> nextstate(main 3 -e:4) v
-# 10 <#> gvsv[*chk] s
-# 11 <1> postinc[t3] sK/1
-# 12 <1> leavesub[1 ref] K/REFC,1
+# o <;> nextstate(main 3 -e:1) v
+# p <#> gvsv[*chk] s
+# q <1> postinc[t3] sK/1
+# r <1> leavesub[1 ref] K/REFC,1
EOT_EOT
# BEGIN 1:
-# 1 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
-# 2 <$> const(PV "strict.pm") s/BARE
+# 1 <;> nextstate(B::Concise -234 Concise.pm:328) v/2
+# 2 <$> const(PV "warnings.pm") s/BARE
# 3 <1> require sK/1
-# 4 <;> nextstate(B::Concise -242 Concise.pm:304) v/2
-# 5 <;> nextstate(B::Concise -242 Concise.pm:304) /2
+# 4 <;> nextstate(B::Concise -234 Concise.pm:328) v/2
+# 5 <;> nextstate(B::Concise -234 Concise.pm:328) /2
# 6 <0> pushmark s
-# 7 <$> const(PV "strict") sM
-# 8 <$> const(PV "refs") sM
+# 7 <$> const(PV "warnings") sM
+# 8 <$> const(PV "qw") sM
# 9 <$> method_named(PVIV 1520340202)
# a <1> entersub[t1] KS*/TARG,2
# b <1> leavesub[1 ref] K/REFC,1
# BEGIN 2:
-# c <;> nextstate(B::Concise -227 Concise.pm:327) v/2
-# d <$> const(PV "warnings.pm") s/BARE
-# e <1> require sK/1
-# f <;> nextstate(B::Concise -227 Concise.pm:327) v/2
-# g <;> nextstate(B::Concise -227 Concise.pm:327) /2
-# h <0> pushmark s
-# i <$> const(PV "warnings") sM
-# j <$> const(PV "qw") sM
-# k <$> method_named(PVIV 1520340202)
-# l <1> entersub[t1] KS*/TARG,2
-# m <1> leavesub[1 ref] K/REFC,1
-# BEGIN 3:
-# n <;> nextstate(main 2 -e:3) v
-# o <$> gvsv(*beg) s
-# p <1> postinc[t2] sK/1
-# q <1> leavesub[1 ref] K/REFC,1
+# c <;> nextstate(main 2 -e:1) v
+# d <$> gvsv(*beg) s
+# e <1> postinc[t2] sK/1
+# f <1> leavesub[1 ref] K/REFC,1
# END 1:
-# r <;> nextstate(main 5 -e:6) v
-# s <$> gvsv(*end) s
-# t <1> postinc[t2] sK/1
-# u <1> leavesub[1 ref] K/REFC,1
+# g <;> nextstate(main 5 -e:1) v
+# h <$> gvsv(*end) s
+# i <1> postinc[t2] sK/1
+# j <1> leavesub[1 ref] K/REFC,1
# INIT 1:
-# v <;> nextstate(main 4 -e:5) v
-# w <$> gvsv(*init) s
-# x <1> postinc[t2] sK/1
-# y <1> leavesub[1 ref] K/REFC,1
+# k <;> nextstate(main 4 -e:1) v
+# l <$> gvsv(*init) s
+# m <1> postinc[t2] sK/1
+# n <1> leavesub[1 ref] K/REFC,1
# CHECK 1:
-# z <;> nextstate(main 3 -e:4) v
-# 10 <$> gvsv(*chk) s
-# 11 <1> postinc[t2] sK/1
-# 12 <1> leavesub[1 ref] K/REFC,1
+# o <;> nextstate(main 3 -e:1) v
+# p <$> gvsv(*chk) s
+# q <1> postinc[t2] sK/1
+# r <1> leavesub[1 ref] K/REFC,1
EONT_EONT
diff --git a/ext/B/t/stash.t b/ext/B/t/stash.t
index 8b44e8a66f..a6e4635043 100755
--- a/ext/B/t/stash.t
+++ b/ext/B/t/stash.t
@@ -76,7 +76,7 @@ print "# got = @got\n";
$got = "@got";
-my $expected = "attributes Carp Carp::Heavy DB Exporter Exporter::Heavy Internals main Regexp utf8 version warnings";
+my $expected = "attributes Carp Carp::Heavy DB Internals main Regexp utf8 version warnings";
$expected =~ s/version // if $] < 5.009;
@@ -88,7 +88,7 @@ $expected =~ s/version // if $] < 5.009;
if ((($Config{static_ext} eq ' ') || ($Config{static_ext} eq ''))
&& !($^O eq 'os2' and $OS2::is_aout)
) {
- print "# [$got]\n# vs.\n# [$expected]\nnot " if $got ne $expected;
+ print "# got [$got]\n# vs.\n# expected [$expected]\nnot " if $got ne $expected;
ok;
} else {
print "ok $test # skipped: one or more static extensions\n"; $test++;
diff --git a/lib/Carp.pm b/lib/Carp.pm
index 86f0d921ee..b2e634ca5f 100644
--- a/lib/Carp.pm
+++ b/lib/Carp.pm
@@ -1,6 +1,6 @@
package Carp;
-our $VERSION = '1.03';
+our $VERSION = '1.04';
=head1 NAME
@@ -178,9 +178,11 @@ Defaults to C<0>.
=cut
-
+# disable these by default, so they can live w/o require Carp
$CarpInternal{Carp}++;
$CarpInternal{warnings}++;
+$Internal{Exporter}++;
+$Internal{'Exporter::Heavy'}++;
$CarpLevel = 0; # How many extra package levels to skip on carp.
# How many calls to skip on confess.
# Reconciling these notions is hard, use
diff --git a/lib/English.pm b/lib/English.pm
index 118a95a001..250549d059 100644
--- a/lib/English.pm
+++ b/lib/English.pm
@@ -1,6 +1,6 @@
package English;
-our $VERSION = '1.02';
+our $VERSION = '1.03';
require Exporter;
@ISA = (Exporter);
@@ -64,7 +64,7 @@ sub import {
}
|| do {
require Carp ;
- Carp::croak "Can't create English for match leftovers: $@" ;
+ Carp::croak("Can't create English for match leftovers: $@") ;
}
) ;
}
diff --git a/lib/Exporter.pm b/lib/Exporter.pm
index d9c2204977..2b860f384a 100644
--- a/lib/Exporter.pm
+++ b/lib/Exporter.pm
@@ -9,9 +9,10 @@ require 5.006;
our $Debug = 0;
our $ExportLevel = 0;
our $Verbose ||= 0;
-our $VERSION = '5.58';
+our $VERSION = '5.59';
our (%Cache);
-$Carp::Internal{Exporter} = 1;
+# Carp does this now for us, so we can finally live w/o Carp
+#$Carp::Internal{Exporter} = 1;
sub as_heavy {
require Exporter::Heavy;
diff --git a/lib/Exporter.t b/lib/Exporter.t
index 548613d11b..01c7891da8 100644
--- a/lib/Exporter.t
+++ b/lib/Exporter.t
@@ -75,7 +75,7 @@ $seat = 'seat';
BEGIN {*is = \&Is};
sub Is { 'Is' };
-Exporter::export_ok_tags;
+Exporter::export_ok_tags();
my %tags = map { $_ => 1 } map { @$_ } values %EXPORT_TAGS;
my %exportok = map { $_ => 1 } @EXPORT_OK;
diff --git a/lib/Exporter/Heavy.pm b/lib/Exporter/Heavy.pm
index 2cc792288f..27774c5a9a 100644
--- a/lib/Exporter/Heavy.pm
+++ b/lib/Exporter/Heavy.pm
@@ -5,7 +5,8 @@ no strict 'refs';
# On one line so MakeMaker will see it.
require Exporter; our $VERSION = $Exporter::VERSION;
-$Carp::Internal{"Exporter::Heavy"} = 1;
+# Carp does this now for us, so we can finally live w/o Carp
+#$Carp::Internal{"Exporter::Heavy"} = 1;
=head1 NAME
diff --git a/lib/vars_carp.t b/lib/vars_carp.t
new file mode 100644
index 0000000000..85a19513b5
--- /dev/null
+++ b/lib/vars_carp.t
@@ -0,0 +1,16 @@
+#!./perl
+
+# test that "use vars;" doesn't load Carp
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ $ENV{PERL5LIB} = '../lib';
+}
+
+$| = 1;
+
+print "1..1\n";
+
+# Carp not loaded yet;
+print defined $Carp::VERSION ? "not ok 1\n" : "ok 1\n";
diff --git a/lib/warnings.pm b/lib/warnings.pm
index 32f020eb94..86e4fcee0a 100644
--- a/lib/warnings.pm
+++ b/lib/warnings.pm
@@ -6,7 +6,7 @@
package warnings;
-our $VERSION = '1.03';
+our $VERSION = '1.04';
=head1 NAME
@@ -131,8 +131,6 @@ See L<perlmodlib/Pragmatic Modules> and L<perllexwarn>.
=cut
-use Carp ();
-
our %Offsets = (
# Warnings Categories added in Perl 5.008
@@ -300,6 +298,7 @@ $All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
sub Croaker
{
+ require Carp;
delete $Carp::CarpInternal{'warnings'};
Carp::croak(@_);
}
@@ -473,6 +472,7 @@ sub warn
my $message = pop ;
my ($callers_bitmask, $offset, $i) = __chk(@_) ;
+ require Carp;
Carp::croak($message)
if vec($callers_bitmask, $offset+1, 1) ||
vec($callers_bitmask, $Offsets{'all'}+1, 1) ;
@@ -492,6 +492,7 @@ sub warnif
(vec($callers_bitmask, $offset, 1) ||
vec($callers_bitmask, $Offsets{'all'}, 1)) ;
+ require Carp;
Carp::croak($message)
if vec($callers_bitmask, $offset+1, 1) ||
vec($callers_bitmask, $Offsets{'all'}+1, 1) ;
diff --git a/warnings.pl b/warnings.pl
index aae186efad..43f0aa6e12 100644
--- a/warnings.pl
+++ b/warnings.pl
@@ -477,7 +477,7 @@ __END__
package warnings;
-our $VERSION = '1.03';
+our $VERSION = '1.04';
=head1 NAME
@@ -602,14 +602,13 @@ See L<perlmodlib/Pragmatic Modules> and L<perllexwarn>.
=cut
-use Carp ();
-
KEYWORDS
$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
sub Croaker
{
+ require Carp;
delete $Carp::CarpInternal{'warnings'};
Carp::croak(@_);
}
@@ -783,6 +782,7 @@ sub warn
my $message = pop ;
my ($callers_bitmask, $offset, $i) = __chk(@_) ;
+ require Carp;
Carp::croak($message)
if vec($callers_bitmask, $offset+1, 1) ||
vec($callers_bitmask, $Offsets{'all'}+1, 1) ;
@@ -802,6 +802,7 @@ sub warnif
(vec($callers_bitmask, $offset, 1) ||
vec($callers_bitmask, $Offsets{'all'}, 1)) ;
+ require Carp;
Carp::croak($message)
if vec($callers_bitmask, $offset+1, 1) ||
vec($callers_bitmask, $Offsets{'all'}+1, 1) ;