← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:09 2010

File /usr/local/lib/perl/5.10.0/Moose/Error/Default.pm
Statements Executed 20
Total Time 0.0005241 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sMoose::Error::Default::::BEGINMoose::Error::Default::BEGIN
0000s0sMoose::Error::Default::::_create_error_carpmessMoose::Error::Default::_create_error_carpmess
0000s0sMoose::Error::Default::::create_error_confessMoose::Error::Default::create_error_confess
0000s0sMoose::Error::Default::::create_error_croakMoose::Error::Default::create_error_croak
0000s0sMoose::Error::Default::::newMoose::Error::Default::new
LineStmts.Exclusive
Time
Avg.Code
1package Moose::Error::Default;
2
3328µs9µsuse strict;
# spent 10µs making 1 call to strict::import
4351µs17µsuse warnings;
# spent 23µs making 1 call to warnings::import
5
61800ns800nsour $VERSION = '1.15';
7119µs19µs$VERSION = eval $VERSION;
81700ns700nsour $AUTHORITY = 'cpan:STEVAN';
9
103140µs47µsuse Carp::Heavy;
# spent 4µs making 1 call to import
11324µs8µsuse Class::MOP::MiniTrait;
# spent 3µs making 1 call to import
12
133241µs80µsuse base 'Class::MOP::Object';
# spent 77µs making 1 call to base::import
14
1516µs6µsClass::MOP::MiniTrait::apply(__PACKAGE__, 'Moose::Meta::Object::Trait');
# spent 2.01ms making 1 call to Class::MOP::MiniTrait::apply
16
17sub new {
18 my ( $self, @args ) = @_;
19 $self->create_error_confess( @args );
20}
21
22sub create_error_croak {
23 my ( $self, @args ) = @_;
24 $self->_create_error_carpmess( @args );
25}
26
27sub create_error_confess {
28 my ( $self, @args ) = @_;
29 $self->_create_error_carpmess( @args, longmess => 1 );
30}
31
32sub _create_error_carpmess {
33 my ( $self, %args ) = @_;
34
35 my $carp_level = 3 + ( $args{depth} || 1 );
36 local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though
37
38 my @args = exists $args{message} ? $args{message} : ();
39
40 if ( $args{longmess} || $Carp::Verbose ) {
41 local $Carp::CarpLevel = ( $Carp::CarpLevel || 0 ) + $carp_level;
42 return Carp::longmess(@args);
43 } else {
44 return Carp::ret_summary($carp_level, @args);
45 }
46}
47
48114µs14µs__PACKAGE__
49
50__END__
51
52=pod
53
54=head1 NAME
55
56Moose::Error::Default - L<Carp> based error generation for Moose.
57
58=head1 DESCRIPTION
59
60This class implements L<Carp> based error generation.
61
62The default behavior is like L<Moose::Error::Confess>.
63
64=head1 METHODS
65
66=over 4
67
68=item new @args
69
70Create a new error. Delegates to C<create_error_confess>.
71
72=item create_error_confess @args
73
74=item create_error_croak @args
75
76Creates a new errors string of the specified style.
77
78=back
79
80=cut
81
82