← Index
Performance Profile   « block view • line view • sub view »
For ./awstats.pl
  Run on Wed Feb 11 19:11:27 2009
Reported on Thu Feb 12 02:07:45 2009

File/usr/share/perl/5.8/Carp.pm
Statements Executed14
Total Time0.001613 seconds

Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
00000Carp::carp
00000Carp::cluck
00000Carp::confess
00000Carp::croak
00000Carp::export_fail
00000Carp::longmess
00000Carp::shortmess

LineStmts.Exclusive
Time
Avg.Code
1package Carp;
2
312.0e-62.0e-6our $VERSION = '1.04';
4
5# This package is heavily used. Be small. Be fast. Be good.
6
7# Comments added by Andy Wardley <abw@kfs.org> 09-Apr-98, based on an
8# _almost_ complete understanding of the package. Corrections and
9# comments are welcome.
10
11# The members of %Internal are packages that are internal to perl.
12# Carp will not report errors from within these packages if it
13# can. The members of %CarpInternal are internal to Perl's warning
14# system. Carp will not report errors from within these packages
15# either, and will not report calls *to* these packages for carp and
16# croak. They replace $CarpLevel, which is deprecated. The
17# $Max(EvalLen|(Arg(Len|Nums)) variables are used to specify how the eval
18# text and function arguments should be formatted when printed.
19
20# Comments added by Jos I. Boumans <kane@dwim.org> 11-Aug-2004
21# I can not get %CarpInternal or %Internal to work as advertised,
22# therefor leaving it out of the below documentation.
23# $CarpLevel may be decprecated according to the last comment, but
24# after 6 years, it's still around and in heavy use ;)
25
2613.0e-63.0e-6$CarpInternal{Carp}++;
2711.0e-61.0e-6$CarpInternal{warnings}++;
2811.0e-61.0e-6$CarpLevel = 0; # How many extra package levels to skip on carp.
29 # How many calls to skip on confess.
30 # Reconciling these notions is hard, use
31 # %Internal and %CarpInternal instead.
3211.0e-61.0e-6$MaxEvalLen = 0; # How much eval '...text...' to show. 0 = all.
3311.0e-61.0e-6$MaxArgLen = 64; # How much of each argument to print. 0 = all.
3411.0e-61.0e-6$MaxArgNums = 8; # How many arguments to print. 0 = all.
3511.0e-61.0e-6$Verbose = 0; # If true then make shortmess call longmess instead
36
3710.001580.00158require Exporter;
3816.0e-66.0e-6@ISA = ('Exporter');
3912.0e-62.0e-6@EXPORT = qw(confess croak carp);
4012.0e-62.0e-6@EXPORT_OK = qw(cluck verbose longmess shortmess);
4112.0e-62.0e-6@EXPORT_FAIL = qw(verbose); # hook to enable verbose mode
42
43# if the caller specifies verbose usage ("perl -MCarp=verbose script.pl")
44# then the following method will be called by the Exporter which knows
45# to do this thanks to @EXPORT_FAIL, above. $_[1] will contain the word
46# 'verbose'.
47
48sub export_fail {
49 shift;
50 $Verbose = shift if $_[0] eq 'verbose';
51 return @_;
52}
53
54# longmess() crawls all the way up the stack reporting on all the function
55# calls made. The error string, $error, is originally constructed from the
56# arguments passed into longmess() via confess(), cluck() or shortmess().
57# This gets appended with the stack trace messages which are generated for
58# each function call on the stack.
59
60sub longmess {
61 {
62 local($@, $!);
63 # XXX fix require to not clear $@ or $!?
64 # don't use require unless we need to (for Safe compartments)
65 require Carp::Heavy unless $INC{"Carp/Heavy.pm"};
66 }
67 # Icky backwards compatibility wrapper. :-(
68 my $call_pack = caller();
69 if ($Internal{$call_pack} or $CarpInternal{$call_pack}) {
70 return longmess_heavy(@_);
71 }
72 else {
73 local $CarpLevel = $CarpLevel + 1;
74 return longmess_heavy(@_);
75 }
76}
77
78# shortmess() is called by carp() and croak() to skip all the way up to
79# the top-level caller's package and report the error from there. confess()
80# and cluck() generate a full stack trace so they call longmess() to
81# generate that. In verbose mode shortmess() calls longmess() so
82# you always get a stack trace
83
84sub shortmess { # Short-circuit &longmess if called via multiple packages
85 {
86 local($@, $!);
87 # XXX fix require to not clear $@ or $!?
88 # don't use require unless we need to (for Safe compartments)
89 require Carp::Heavy unless $INC{"Carp/Heavy.pm"};
90 }
91 # Icky backwards compatibility wrapper. :-(
92 my $call_pack = caller();
93 local @CARP_NOT = caller();
94 shortmess_heavy(@_);
95}
96
97# the following four functions call longmess() or shortmess() depending on
98# whether they should generate a full stack trace (confess() and cluck())
99# or simply report the caller's package (croak() and carp()), respectively.
100# confess() and croak() die, carp() and cluck() warn.
101
102sub croak { die shortmess @_ }
103sub confess { die longmess @_ }
104sub carp { warn shortmess @_ }
105sub cluck { warn longmess @_ }
106
10711.4e-51.4e-51;