Filename | /Users/dde/perl5/perlbrew/perls/5.18.0t/lib/site_perl/5.18.0/darwin-thread-multi-2level/Moose/Error/Util.pm |
Statements | Executed 7 statements in 233µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 10µs | 21µs | BEGIN@4 | Moose::Error::Util::
1 | 1 | 1 | 6µs | 9µs | BEGIN@5 | Moose::Error::Util::
1 | 1 | 1 | 4µs | 4µs | BEGIN@10 | Moose::Error::Util::
0 | 0 | 0 | 0s | 0s | _create_error_carpmess | Moose::Error::Util::
0 | 0 | 0 | 0s | 0s | create_error | Moose::Error::Util::
0 | 0 | 0 | 0s | 0s | create_error_confess | Moose::Error::Util::
0 | 0 | 0 | 0s | 0s | create_error_croak | Moose::Error::Util::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package # pretend this doesn't exist, because it shouldn't | ||||
2 | Moose::Error::Util; | ||||
3 | |||||
4 | 2 | 21µs | 2 | 32µs | # spent 21µs (10+11) within Moose::Error::Util::BEGIN@4 which was called:
# once (10µs+11µs) by Moose::Error::Default::BEGIN@15 at line 4 # spent 21µs making 1 call to Moose::Error::Util::BEGIN@4
# spent 11µs making 1 call to strict::import |
5 | 2 | 25µs | 2 | 12µs | # spent 9µs (6+3) within Moose::Error::Util::BEGIN@5 which was called:
# once (6µs+3µs) by Moose::Error::Default::BEGIN@15 at line 5 # spent 9µs making 1 call to Moose::Error::Util::BEGIN@5
# spent 3µs making 1 call to warnings::import |
6 | |||||
7 | # this intentionally exists to have a place to put this logic that doesn't | ||||
8 | # involve loading Class::MOP, so... don't do that | ||||
9 | |||||
10 | 2 | 185µs | 1 | 4µs | # spent 4µs within Moose::Error::Util::BEGIN@10 which was called:
# once (4µs+0s) by Moose::Error::Default::BEGIN@15 at line 10 # spent 4µs making 1 call to Moose::Error::Util::BEGIN@10 |
11 | |||||
12 | sub _create_error_carpmess { | ||||
13 | my %args = @_; | ||||
14 | |||||
15 | my $carp_level = 3 + ( $args{depth} || 0 ); | ||||
16 | local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though | ||||
17 | |||||
18 | my @args = exists $args{message} ? $args{message} : (); | ||||
19 | |||||
20 | if ( $args{longmess} || $Carp::Verbose ) { | ||||
21 | local $Carp::CarpLevel = ( $Carp::CarpLevel || 0 ) + $carp_level; | ||||
22 | return Carp::longmess(@args); | ||||
23 | } else { | ||||
24 | return Carp::ret_summary($carp_level, @args); | ||||
25 | } | ||||
26 | } | ||||
27 | |||||
28 | sub create_error_croak { | ||||
29 | _create_error_carpmess(@_); | ||||
30 | } | ||||
31 | |||||
32 | sub create_error_confess { | ||||
33 | _create_error_carpmess(@_, longmess => 1); | ||||
34 | } | ||||
35 | |||||
36 | sub create_error { | ||||
37 | if (defined $ENV{MOOSE_ERROR_STYLE} && $ENV{MOOSE_ERROR_STYLE} eq 'croak') { | ||||
38 | create_error_croak(@_); | ||||
39 | } | ||||
40 | else { | ||||
41 | create_error_confess(@_); | ||||
42 | } | ||||
43 | } | ||||
44 | |||||
45 | 1 | 2µs | 1; | ||
46 | |||||
47 | __END__ |