| File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Class/MOP/Method/Generated.pm |
| Statements Executed | 4670 |
| Statement Execution Time | 63.0ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 236 | 7 | 3 | 27.5ms | 27.9ms | Class::MOP::Method::Generated::_eval_closure |
| 101 | 3 | 3 | 1.17ms | 18.0ms | Class::MOP::Method::Generated::_compile_code |
| 101 | 1 | 1 | 1.08ms | 1.22ms | Class::MOP::Method::Generated::_add_line_directive |
| 1 | 1 | 1 | 641µs | 917µs | Class::MOP::Method::Generated::BEGIN@15 |
| 307 | 2 | 2 | 351µs | 351µs | Class::MOP::Method::Generated::is_inline |
| 101 | 1 | 1 | 138µs | 138µs | Class::MOP::Method::Generated::definition_context |
| 1 | 1 | 1 | 19µs | 21µs | Class::MOP::Method::Generated::BEGIN@4 |
| 1 | 1 | 1 | 7µs | 16µs | Class::MOP::Method::Generated::BEGIN@5 |
| 1 | 1 | 1 | 7µs | 46µs | Class::MOP::Method::Generated::BEGIN@13 |
| 1 | 1 | 1 | 6µs | 29µs | Class::MOP::Method::Generated::BEGIN@7 |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Generated::_initialize_body |
| 0 | 0 | 0 | 0s | 0s | Class::MOP::Method::Generated::new |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package Class::MOP::Method::Generated; | ||||
| 3 | |||||
| 4 | 3 | 22µs | 2 | 24µs | # spent 21µs (19+3) within Class::MOP::Method::Generated::BEGIN@4 which was called
# once (19µs+3µs) by base::import at line 4 # spent 21µs making 1 call to Class::MOP::Method::Generated::BEGIN@4
# spent 3µs making 1 call to strict::import |
| 5 | 3 | 20µs | 2 | 24µs | # spent 16µs (7+9) within Class::MOP::Method::Generated::BEGIN@5 which was called
# once (7µs+9µs) by base::import at line 5 # spent 16µs making 1 call to Class::MOP::Method::Generated::BEGIN@5
# spent 9µs making 1 call to warnings::import |
| 6 | |||||
| 7 | 3 | 60µs | 2 | 52µs | # spent 29µs (6+23) within Class::MOP::Method::Generated::BEGIN@7 which was called
# once (6µs+23µs) by base::import at line 7 # spent 29µs making 1 call to Class::MOP::Method::Generated::BEGIN@7
# spent 23µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 600ns | our $VERSION = '0.98'; | ||
| 10 | 1 | 13µs | $VERSION = eval $VERSION; | ||
| 11 | 1 | 300ns | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 12 | |||||
| 13 | 3 | 39µs | 2 | 46µs | # spent 46µs (7+40) within Class::MOP::Method::Generated::BEGIN@13 which was called
# once (7µs+40µs) by base::import at line 13 # spent 46µs making 1 call to Class::MOP::Method::Generated::BEGIN@13
# spent 40µs making 1 call to base::import, recursion: max depth 1, time 40µs |
| 14 | |||||
| 15 | 3 | 395µs | 2 | 976µs | # spent 917µs (641+275) within Class::MOP::Method::Generated::BEGIN@15 which was called
# once (641µs+275µs) by base::import at line 15 # spent 917µs making 1 call to Class::MOP::Method::Generated::BEGIN@15
# spent 59µs making 1 call to constant::import |
| 16 | |||||
| 17 | ## accessors | ||||
| 18 | |||||
| 19 | sub new { | ||||
| 20 | confess __PACKAGE__ . " is an abstract base class, you must provide a constructor."; | ||||
| 21 | } | ||||
| 22 | |||||
| 23 | 307 | 543µs | # spent 351µs within Class::MOP::Method::Generated::is_inline which was called 307 times, avg 1µs/call:
# 276 times (315µs+0s) by Class::MOP::Method::Accessor::_initialize_body at line 80 of Class/MOP/Method/Accessor.pm, avg 1µs/call
# 31 times (36µs+0s) by Class::MOP::Method::Constructor::_initialize_body at line 91 of Class/MOP/Method/Constructor.pm, avg 1µs/call | ||
| 24 | |||||
| 25 | 101 | 237µs | # spent 138µs within Class::MOP::Method::Generated::definition_context which was called 101 times, avg 1µs/call:
# 101 times (138µs+0s) by Class::MOP::Method::Generated::_add_line_directive at line 66, avg 1µs/call | ||
| 26 | |||||
| 27 | sub _initialize_body { | ||||
| 28 | confess "No body to initialize, " . __PACKAGE__ . " is an abstract base class"; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | # spent 27.9ms (27.5+358µs) within Class::MOP::Method::Generated::_eval_closure which was called 236 times, avg 118µs/call:
# 101 times (15.3ms+325µs) by Class::MOP::Method::Generated::_compile_code at line 91, avg 154µs/call
# 52 times (2.98ms+0s) by Class::MOP::Method::Accessor::_generate_reader_method_inline at line 157 of Class/MOP/Method/Accessor.pm, avg 57µs/call
# 31 times (6.58ms+32µs) by Class::MOP::Method::Constructor::_generate_constructor_method_inline at line 121 of Class/MOP/Method/Constructor.pm, avg 213µs/call
# 31 times (1.49ms+0s) by Class::MOP::Method::Accessor::_generate_predicate_method_inline at line 192 of Class/MOP/Method/Accessor.pm, avg 48µs/call
# 15 times (912µs+0s) by Class::MOP::Method::Accessor::_generate_accessor_method_inline at line 138 of Class/MOP/Method/Accessor.pm, avg 61µs/call
# 3 times (160µs+0s) by Class::MOP::Method::Accessor::_generate_writer_method_inline at line 175 of Class/MOP/Method/Accessor.pm, avg 53µs/call
# 3 times (155µs+0s) by Class::MOP::Method::Accessor::_generate_clearer_method_inline at line 209 of Class/MOP/Method/Accessor.pm, avg 52µs/call | ||||
| 32 | # my ($self, $captures, $sub_body) = @_; | ||||
| 33 | 236 | 54µs | my $__captures = $_[1]; | ||
| 34 | |||||
| 35 | 236 | 27µs | my $code; | ||
| 36 | |||||
| 37 | 236 | 105µs | my $e = do { | ||
| 38 | 236 | 34µs | local $@; | ||
| 39 | 236 | 476µs | local $SIG{__DIE__}; | ||
| 40 | 401 | 945µs | 401 | 358µs | my $source = join # spent 358µs making 401 calls to Class::MOP::Method::Generated::CORE:match, avg 892ns/call |
| 41 | "\n", ( | ||||
| 42 | map { | ||||
| 43 | 236 | 711µs | /^([\@\%\$])/ | ||
| 44 | or die "capture key should start with \@, \% or \$: $_"; | ||||
| 45 | 401 | 400µs | q[my ] | ||
| 46 | . $_ . q[ = ] | ||||
| 47 | . $1 | ||||
| 48 | . q[{$__captures->{'] | ||||
| 49 | . $_ . q['}};]; | ||||
| 50 | } keys %$__captures | ||||
| 51 | ), | ||||
| 52 | $_[2]; | ||||
| 53 | 236 | 1µs | print STDERR "\n", $_[0]->name, ":\n", $source, "\n" if _PRINT_SOURCE; | ||
| 54 | 236 | 55.8ms | 492 | 6.75ms | $code = eval $source; # spent 6.00ms making 13 calls to Moose::Meta::Class::new_object, avg 462µs/call
# spent 139µs making 84 calls to Class::MOP::__ANON__[Class/MOP.pm:494], avg 2µs/call
# spent 125µs making 66 calls to Moose::Meta::TypeConstraint::__ANON__[Moose/Meta/TypeConstraint.pm:30], avg 2µs/call
# spent 81µs making 13 calls to Class::MOP::Class::initialize, avg 6µs/call
# spent 66µs making 66 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:256], avg 1µs/call
# spent 59µs making 44 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:83], avg 1µs/call
# spent 49µs making 26 calls to Moose::Meta::Role::Application::__ANON__[Moose/Meta/Role/Application.pm:14], avg 2µs/call
# spent 47µs making 26 calls to Moose::Meta::Role::Application::__ANON__[Moose/Meta/Role/Application.pm:20], avg 2µs/call
# spent 32µs making 22 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:301], avg 1µs/call
# spent 27µs making 22 calls to Moose::Meta::Role::__ANON__[Moose/Meta/Role.pm:352], avg 1µs/call
# spent 26µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:286], avg 1µs/call
# spent 26µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:176], avg 1µs/call
# spent 25µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:260], avg 1µs/call
# spent 24µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:305], avg 1µs/call
# spent 22µs making 22 calls to Class::MOP::__ANON__[Class/MOP.pm:218], avg 1µs/call |
| 55 | 236 | 404µs | $@; | ||
| 56 | }; | ||||
| 57 | |||||
| 58 | 236 | 908µs | return ( $code, $e ); | ||
| 59 | } | ||||
| 60 | |||||
| 61 | # spent 1.22ms (1.08+138µs) within Class::MOP::Method::Generated::_add_line_directive which was called 101 times, avg 12µs/call:
# 101 times (1.08ms+138µs) by Class::MOP::Method::Generated::_compile_code at line 89, avg 12µs/call | ||||
| 62 | 101 | 132µs | my ( $self, %args ) = @_; | ||
| 63 | |||||
| 64 | 101 | 23µs | my ( $line, $file ); | ||
| 65 | |||||
| 66 | 101 | 208µs | 101 | 138µs | if ( my $ctx = ( $args{context} || $self->definition_context ) ) { # spent 138µs making 101 calls to Class::MOP::Method::Generated::definition_context, avg 1µs/call |
| 67 | 71 | 31µs | $line = $ctx->{line}; | ||
| 68 | 71 | 87µs | if ( my $desc = $ctx->{description} ) { | ||
| 69 | $file = "$desc defined at $ctx->{file}"; | ||||
| 70 | } else { | ||||
| 71 | $file = $ctx->{file}; | ||||
| 72 | } | ||||
| 73 | } else { | ||||
| 74 | 30 | 18µs | ( $line, $file ) = ( 0, "generated method (unknown origin)" ); | ||
| 75 | } | ||||
| 76 | |||||
| 77 | 101 | 45µs | my $code = $args{code}; | ||
| 78 | |||||
| 79 | # if it's an array of lines, join it up | ||||
| 80 | # don't use newlines so that the definition context is more meaningful | ||||
| 81 | 101 | 15µs | $code = join(@$code, ' ') if ref $code; | ||
| 82 | |||||
| 83 | 101 | 427µs | return qq{#line $line "$file"\n} . $code; | ||
| 84 | } | ||||
| 85 | |||||
| 86 | # spent 18.0ms (1.17+16.8) within Class::MOP::Method::Generated::_compile_code which was called 101 times, avg 178µs/call:
# 89 times (1.01ms+14.3ms) by Moose::Meta::Method::Accessor::_eval_code at line 36 of Moose/Meta/Method/Accessor.pm, avg 172µs/call
# 6 times (94µs+2.26ms) by Moose::Meta::Method::Constructor::_initialize_body at line 96 of Moose/Meta/Method/Constructor.pm, avg 392µs/call
# 6 times (64µs+275µs) by Moose::Meta::Method::Destructor::_initialize_body at line 108 of Moose/Meta/Method/Destructor.pm, avg 57µs/call | ||||
| 87 | 101 | 184µs | my ( $self, %args ) = @_; | ||
| 88 | |||||
| 89 | 101 | 256µs | 101 | 1.22ms | my $code = $self->_add_line_directive(%args); # spent 1.22ms making 101 calls to Class::MOP::Method::Generated::_add_line_directive, avg 12µs/call |
| 90 | |||||
| 91 | 101 | 439µs | 101 | 15.6ms | return $self->_eval_closure($args{environment}, $code); # spent 15.6ms making 101 calls to Class::MOP::Method::Generated::_eval_closure, avg 154µs/call |
| 92 | } | ||||
| 93 | |||||
| 94 | 1 | 4µs | 1; | ||
| 95 | |||||
| 96 | __END__ | ||||
| 97 | |||||
| 98 | =pod | ||||
| 99 | |||||
| 100 | =head1 NAME | ||||
| 101 | |||||
| 102 | Class::MOP::Method::Generated - Abstract base class for generated methods | ||||
| 103 | |||||
| 104 | =head1 DESCRIPTION | ||||
| 105 | |||||
| 106 | This is a C<Class::MOP::Method> subclass which is subclassed by | ||||
| 107 | C<Class::MOP::Method::Accessor> and | ||||
| 108 | C<Class::MOP::Method::Constructor>. | ||||
| 109 | |||||
| 110 | It is not intended to be used directly. | ||||
| 111 | |||||
| 112 | =head1 AUTHORS | ||||
| 113 | |||||
| 114 | Stevan Little E<lt>stevan@iinteractive.comE<gt> | ||||
| 115 | |||||
| 116 | =head1 COPYRIGHT AND LICENSE | ||||
| 117 | |||||
| 118 | Copyright 2006-2010 by Infinity Interactive, Inc. | ||||
| 119 | |||||
| 120 | L<http://www.iinteractive.com> | ||||
| 121 | |||||
| 122 | This library is free software; you can redistribute it and/or modify | ||||
| 123 | it under the same terms as Perl itself. | ||||
| 124 | |||||
| 125 | =cut | ||||
| 126 |