diff options
author | markm <markm@FreeBSD.org> | 2000-06-25 11:04:01 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2000-06-25 11:04:01 +0000 |
commit | 2618fad5bbb2d0182eb31ed805c41b543c513940 (patch) | |
tree | 52ba93338b13aefd02a0055304a9eccfa0e049f5 /contrib/perl5/lib/CGI/Carp.pm | |
parent | 77644ee620b6a79cf8c538abaf7cd301a875528d (diff) | |
download | FreeBSD-src-2618fad5bbb2d0182eb31ed805c41b543c513940.zip FreeBSD-src-2618fad5bbb2d0182eb31ed805c41b543c513940.tar.gz |
Vendor import of Perl 5.006
Diffstat (limited to 'contrib/perl5/lib/CGI/Carp.pm')
-rw-r--r-- | contrib/perl5/lib/CGI/Carp.pm | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/contrib/perl5/lib/CGI/Carp.pm b/contrib/perl5/lib/CGI/Carp.pm index dfae1a6..90e9552 100644 --- a/contrib/perl5/lib/CGI/Carp.pm +++ b/contrib/perl5/lib/CGI/Carp.pm @@ -192,9 +192,16 @@ use Carp; @EXPORT = qw(confess croak carp); @EXPORT_OK = qw(carpout fatalsToBrowser wrap set_message cluck); +BEGIN { + $] >= 5.005 + ? eval q#sub ineval { $^S }# + : eval q#sub ineval { _longmess() =~ /eval [\{\']/m }#; + $@ and die; +} + $main::SIG{__WARN__}=\&CGI::Carp::warn; $main::SIG{__DIE__}=\&CGI::Carp::die; -$CGI::Carp::VERSION = '1.13'; +$CGI::Carp::VERSION = '1.14'; $CGI::Carp::CUSTOM_MSG = undef; # fancy import routine detects and handles 'errorWrap' specially. @@ -216,7 +223,7 @@ sub realdie { CORE::die(@_); } sub id { my $level = shift; my($pack,$file,$line,$sub) = caller($level); - my($id) = $file=~m|([^/]+)$|; + my($id) = $file=~m|([^/]+)\z|; return ($file,$line,$id); } @@ -228,7 +235,7 @@ sub stamp { $id = $file; ($pack,$file) = caller($frame++); } until !$file; - ($id) = $id=~m|([^/]+)$|; + ($id) = $id=~m|([^/]+)\z|; return "[$time] $id: "; } @@ -251,14 +258,15 @@ sub _longmess { } sub die { - my $message = shift; - my $time = scalar(localtime); - my($file,$line,$id) = id(1); - $message .= " at $file line $line." unless $message=~/\n$/; - &fatalsToBrowser($message) if $WRAP && _longmess() !~ /eval [{\']/m; - my $stamp = stamp; - $message=~s/^/$stamp/gm; - realdie $message; + realdie @_ if ineval; + my $message = shift; + my $time = scalar(localtime); + my($file,$line,$id) = id(1); + $message .= " at $file line $line." unless $message=~/\n$/; + &fatalsToBrowser($message) if $WRAP; + my $stamp = stamp; + $message=~s/^/$stamp/gm; + realdie $message; } sub set_message { |