| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/Moose/Error/Default.pm |
| Statements | Executed 50 statements in 502µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 249µs | 284µs | Moose::Error::Default::BEGIN@15 |
| 1 | 1 | 1 | 76µs | 84µs | Moose::Error::Default::BEGIN@12 |
| 9 | 1 | 1 | 70µs | 70µs | Moose::Error::Default::_inline_new |
| 1 | 1 | 1 | 8µs | 8µs | Moose::Error::Default::BEGIN@2 |
| 1 | 1 | 1 | 7µs | 9µs | Moose::Error::Default::BEGIN@9 |
| 1 | 1 | 1 | 6µs | 14µs | Moose::Error::Default::BEGIN@10 |
| 1 | 1 | 1 | 6µs | 60µs | Moose::Error::Default::BEGIN@17 |
| 1 | 1 | 1 | 5µs | 5µs | Moose::Error::Default::BEGIN@13 |
| 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 | # spent 8µs within Moose::Error::Default::BEGIN@2 which was called:
# once (8µs+0s) by Moose::Meta::Class::BEGIN@23 at line 4 | ||||
| 3 | 1 | 5µs | $Moose::Error::Default::AUTHORITY = 'cpan:STEVAN'; | ||
| 4 | 1 | 28µs | 1 | 8µs | } # spent 8µs making 1 call to Moose::Error::Default::BEGIN@2 |
| 5 | { | ||||
| 6 | 2 | 800ns | $Moose::Error::Default::VERSION = '2.0602'; | ||
| 7 | } | ||||
| 8 | |||||
| 9 | 3 | 20µs | 2 | 12µs | # spent 9µs (7+2) within Moose::Error::Default::BEGIN@9 which was called:
# once (7µs+2µs) by Moose::Meta::Class::BEGIN@23 at line 9 # spent 9µs making 1 call to Moose::Error::Default::BEGIN@9
# spent 2µs making 1 call to strict::import |
| 10 | 3 | 17µs | 2 | 22µs | # spent 14µs (6+8) within Moose::Error::Default::BEGIN@10 which was called:
# once (6µs+8µs) by Moose::Meta::Class::BEGIN@23 at line 10 # spent 14µs making 1 call to Moose::Error::Default::BEGIN@10
# spent 8µs making 1 call to warnings::import |
| 11 | |||||
| 12 | 3 | 72µs | 1 | 84µs | # spent 84µs (76+7) within Moose::Error::Default::BEGIN@12 which was called:
# once (76µs+7µs) by Moose::Meta::Class::BEGIN@23 at line 12 # spent 84µs making 1 call to Moose::Error::Default::BEGIN@12 |
| 13 | 3 | 17µs | 1 | 5µs | # spent 5µs within Moose::Error::Default::BEGIN@13 which was called:
# once (5µs+0s) by Moose::Meta::Class::BEGIN@23 at line 13 # spent 5µs making 1 call to Moose::Error::Default::BEGIN@13 |
| 14 | |||||
| 15 | 3 | 98µs | 1 | 284µs | # spent 284µs (249+34) within Moose::Error::Default::BEGIN@15 which was called:
# once (249µs+34µs) by Moose::Meta::Class::BEGIN@23 at line 15 # spent 284µs making 1 call to Moose::Error::Default::BEGIN@15 |
| 16 | |||||
| 17 | 3 | 159µs | 2 | 113µs | # spent 60µs (6+53) within Moose::Error::Default::BEGIN@17 which was called:
# once (6µs+53µs) by Moose::Meta::Class::BEGIN@23 at line 17 # spent 60µs making 1 call to Moose::Error::Default::BEGIN@17
# spent 53µs making 1 call to base::import |
| 18 | |||||
| 19 | 1 | 2µs | 1 | 1.12ms | Class::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait'); # spent 1.12ms making 1 call to Class::MOP::MiniTrait::apply |
| 20 | |||||
| 21 | sub new { | ||||
| 22 | my ( $self, @args ) = @_; | ||||
| 23 | # can't use Moose::Error::Util::create_error here because that would break | ||||
| 24 | # inheritance. we don't care about that for the inlined version, because | ||||
| 25 | # the inlined versions are explicitly not inherited. | ||||
| 26 | if (defined $ENV{MOOSE_ERROR_STYLE} && $ENV{MOOSE_ERROR_STYLE} eq 'croak') { | ||||
| 27 | $self->create_error_croak( @args ); | ||||
| 28 | } | ||||
| 29 | else { | ||||
| 30 | $self->create_error_confess( @args ); | ||||
| 31 | } | ||||
| 32 | } | ||||
| 33 | |||||
| 34 | # spent 70µs within Moose::Error::Default::_inline_new which was called 9 times, avg 8µs/call:
# 9 times (70µs+0s) by Moose::Meta::Class::_inline_create_error at line 845 of Moose/Meta/Class.pm, avg 8µs/call | ||||
| 35 | 27 | 76µs | my ( $self, %args ) = @_; | ||
| 36 | |||||
| 37 | my $depth = ($args{depth} || 0) - 1; | ||||
| 38 | return 'Moose::Error::Util::create_error(' | ||||
| 39 | . 'message => ' . $args{message} . ', ' | ||||
| 40 | . 'depth => ' . $depth . ', ' | ||||
| 41 | . ')'; | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | sub create_error_croak { | ||||
| 45 | my ( $self, @args ) = @_; | ||||
| 46 | return Moose::Error::Util::create_error_croak(@args); | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | sub create_error_confess { | ||||
| 50 | my ( $self, @args ) = @_; | ||||
| 51 | return Moose::Error::Util::create_error_confess(@args); | ||||
| 52 | } | ||||
| 53 | |||||
| 54 | 1 | 6µs | 1; | ||
| 55 | |||||
| 56 | # ABSTRACT: L<Carp> based error generation for Moose. | ||||
| 57 | |||||
| - - | |||||
| 60 | =pod | ||||
| 61 | |||||
| 62 | =head1 NAME | ||||
| 63 | |||||
| 64 | Moose::Error::Default - L<Carp> based error generation for Moose. | ||||
| 65 | |||||
| 66 | =head1 VERSION | ||||
| 67 | |||||
| 68 | version 2.0602 | ||||
| 69 | |||||
| 70 | =head1 DESCRIPTION | ||||
| 71 | |||||
| 72 | This class implements L<Carp> based error generation. | ||||
| 73 | |||||
| 74 | The default behavior is like L<Moose::Error::Confess>. To override this to | ||||
| 75 | default to L<Moose::Error::Croak>'s behaviour on a system wide basis, set the | ||||
| 76 | MOOSE_ERROR_STYLE environment variable to C<croak>. The use of this | ||||
| 77 | environment variable is considered experimental, and may change in a future | ||||
| 78 | release. | ||||
| 79 | |||||
| 80 | =head1 METHODS | ||||
| 81 | |||||
| 82 | =over 4 | ||||
| 83 | |||||
| 84 | =item B<< Moose::Error::Default->new(@args) >> | ||||
| 85 | |||||
| 86 | Create a new error. Delegates to C<create_error_confess> or | ||||
| 87 | C<create_error_croak>. | ||||
| 88 | |||||
| 89 | =item B<< $error->create_error_confess(@args) >> | ||||
| 90 | |||||
| 91 | =item B<< $error->create_error_croak(@args) >> | ||||
| 92 | |||||
| 93 | Creates a new errors string of the specified style. | ||||
| 94 | |||||
| 95 | =back | ||||
| 96 | |||||
| 97 | =head1 AUTHOR | ||||
| 98 | |||||
| 99 | Moose is maintained by the Moose Cabal, along with the help of many contributors. See L<Moose/CABAL> and L<Moose/CONTRIBUTORS> for details. | ||||
| 100 | |||||
| 101 | =head1 COPYRIGHT AND LICENSE | ||||
| 102 | |||||
| 103 | This software is copyright (c) 2012 by Infinity Interactive, Inc.. | ||||
| 104 | |||||
| 105 | This is free software; you can redistribute it and/or modify it under | ||||
| 106 | the same terms as the Perl 5 programming language system itself. | ||||
| 107 | |||||
| 108 | =cut | ||||
| 109 | |||||
| 110 | |||||
| 111 | __END__ |