| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Error/Default.pm |
| Statements | Executed 20 statements in 2.04ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 5.35ms | 5.88ms | Moose::Error::Default::BEGIN@10 |
| 1 | 1 | 1 | 106µs | 132µs | Moose::Error::Default::BEGIN@3 |
| 1 | 1 | 1 | 60µs | 180µs | Moose::Error::Default::BEGIN@4 |
| 1 | 1 | 1 | 37µs | 282µs | Moose::Error::Default::BEGIN@13 |
| 1 | 1 | 1 | 27µs | 27µs | Moose::Error::Default::BEGIN@11 |
| 0 | 0 | 0 | 0s | 0s | Moose::Error::Default::_create_error_carpmess |
| 0 | 0 | 0 | 0s | 0s | Moose::Error::Default::create_error_confess |
| 0 | 0 | 0 | 0s | 0s | Moose::Error::Default::create_error_croak |
| 0 | 0 | 0 | 0s | 0s | Moose::Error::Default::new |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Error::Default; | ||||
| 2 | |||||
| 3 | 3 | 159µs | 2 | 157µs | # spent 132µs (106+26) within Moose::Error::Default::BEGIN@3 which was called:
# once (106µs+26µs) by Moose::Meta::Class::BEGIN@21 at line 3 # spent 132µs making 1 call to Moose::Error::Default::BEGIN@3
# spent 26µs making 1 call to strict::import |
| 4 | 3 | 337µs | 2 | 300µs | # spent 180µs (60+120) within Moose::Error::Default::BEGIN@4 which was called:
# once (60µs+120µs) by Moose::Meta::Class::BEGIN@21 at line 4 # spent 180µs making 1 call to Moose::Error::Default::BEGIN@4
# spent 120µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 1 | 4µs | our $VERSION = '1.19'; | ||
| 7 | 1 | 62µs | $VERSION = eval $VERSION; # spent 11µs executing statements in string eval | ||
| 8 | 1 | 3µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | 3 | 530µs | 1 | 5.88ms | # spent 5.88ms (5.35+524µs) within Moose::Error::Default::BEGIN@10 which was called:
# once (5.35ms+524µs) by Moose::Meta::Class::BEGIN@21 at line 10 # spent 5.88ms making 1 call to Moose::Error::Default::BEGIN@10 |
| 11 | 3 | 96µs | 1 | 27µs | # spent 27µs within Moose::Error::Default::BEGIN@11 which was called:
# once (27µs+0s) by Moose::Meta::Class::BEGIN@21 at line 11 # spent 27µs making 1 call to Moose::Error::Default::BEGIN@11 |
| 12 | |||||
| 13 | 3 | 816µs | 2 | 527µs | # spent 282µs (37+245) within Moose::Error::Default::BEGIN@13 which was called:
# once (37µs+245µs) by Moose::Meta::Class::BEGIN@21 at line 13 # spent 282µs making 1 call to Moose::Error::Default::BEGIN@13
# spent 245µs making 1 call to base::import |
| 14 | |||||
| 15 | 1 | 14µs | 1 | 7.59ms | Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); # spent 7.59ms making 1 call to Class::MOP::MiniTrait::apply |
| 16 | |||||
| 17 | sub new { | ||||
| 18 | my ( $self, @args ) = @_; | ||||
| 19 | if (defined $ENV{MOOSE_ERROR_STYLE} && $ENV{MOOSE_ERROR_STYLE} eq 'croak') { | ||||
| 20 | $self->create_error_croak( @args ); | ||||
| 21 | } | ||||
| 22 | else { | ||||
| 23 | $self->create_error_confess( @args ); | ||||
| 24 | } | ||||
| 25 | } | ||||
| 26 | |||||
| 27 | sub create_error_croak { | ||||
| 28 | my ( $self, @args ) = @_; | ||||
| 29 | $self->_create_error_carpmess( @args ); | ||||
| 30 | } | ||||
| 31 | |||||
| 32 | sub create_error_confess { | ||||
| 33 | my ( $self, @args ) = @_; | ||||
| 34 | $self->_create_error_carpmess( @args, longmess => 1 ); | ||||
| 35 | } | ||||
| 36 | |||||
| 37 | sub _create_error_carpmess { | ||||
| 38 | my ( $self, %args ) = @_; | ||||
| 39 | |||||
| 40 | my $carp_level = 3 + ( $args{depth} || 1 ); | ||||
| 41 | local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though | ||||
| 42 | |||||
| 43 | my @args = exists $args{message} ? $args{message} : (); | ||||
| 44 | |||||
| 45 | if ( $args{longmess} || $Carp::Verbose ) { | ||||
| 46 | local $Carp::CarpLevel = ( $Carp::CarpLevel || 0 ) + $carp_level; | ||||
| 47 | return Carp::longmess(@args); | ||||
| 48 | } else { | ||||
| 49 | return Carp::ret_summary($carp_level, @args); | ||||
| 50 | } | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | 1 | 22µs | __PACKAGE__ | ||
| 54 | |||||
| 55 | __END__ |