| Filename | /home/doy/perl5/perlbrew/perls/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux/Moose/Meta/Method/Accessor/Native/String/substr.pm |
| Statements | Executed 20 statements in 2.53ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 81µs | 100µs | Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@3 |
| 1 | 1 | 1 | 49µs | 800µs | Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@128 |
| 1 | 1 | 1 | 43µs | 14.7ms | Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@12 |
| 1 | 1 | 1 | 42µs | 111µs | Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@4 |
| 1 | 1 | 1 | 20µs | 20µs | Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@6 |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_generate_method |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_inline_check_arguments |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_inline_optimized_set_new_value |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_inline_process_arguments |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_maximum_arguments |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_minimum_arguments |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_potential_value |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Method::Accessor::Native::String::substr::_return_value |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Method::Accessor::Native::String::substr; | ||||
| 2 | |||||
| 3 | 3 | 120µs | 2 | 118µs | # spent 100µs (81+18) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@3 which was called:
# once (81µs+18µs) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 3 # spent 100µs making 1 call to Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@3
# spent 18µs making 1 call to strict::import |
| 4 | 3 | 100µs | 2 | 179µs | # spent 111µs (42+68) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@4 which was called:
# once (42µs+68µs) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 4 # spent 111µs making 1 call to Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@4
# spent 68µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 219µs | 1 | 20µs | # spent 20µs within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@6 which was called:
# once (20µs+0s) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 6 # spent 20µs making 1 call to Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@6 |
| 7 | |||||
| 8 | 1 | 4µs | our $VERSION = '1.19'; | ||
| 9 | 1 | 86µs | $VERSION = eval $VERSION; # spent 12µs executing statements in string eval | ||
| 10 | 1 | 4µs | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 11 | |||||
| 12 | 3 | 1.77ms | 2 | 29.4ms | # spent 14.7ms (43µs+14.7) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@12 which was called:
# once (43µs+14.7ms) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 12 # spent 14.7ms making 1 call to Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@12
# spent 14.7ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:456] |
| 13 | |||||
| 14 | 1 | 51µs | 1 | 53.7ms | with 'Moose::Meta::Method::Accessor::Native::Reader' => { # spent 53.7ms making 1 call to Moose::Role::with |
| 15 | -excludes => [ | ||||
| 16 | qw( _generate_method | ||||
| 17 | _minimum_arguments | ||||
| 18 | _maximum_arguments | ||||
| 19 | _inline_process_arguments | ||||
| 20 | _inline_check_arguments | ||||
| 21 | _return_value | ||||
| 22 | ) | ||||
| 23 | ] | ||||
| 24 | }, | ||||
| 25 | 'Moose::Meta::Method::Accessor::Native::Writer' => { | ||||
| 26 | -excludes => [ | ||||
| 27 | qw( | ||||
| 28 | _generate_method | ||||
| 29 | _minimum_arguments | ||||
| 30 | _maximum_arguments | ||||
| 31 | _inline_process_arguments | ||||
| 32 | _inline_check_arguments | ||||
| 33 | _inline_optimized_set_new_value | ||||
| 34 | _return_value | ||||
| 35 | ) | ||||
| 36 | ] | ||||
| 37 | }; | ||||
| 38 | |||||
| 39 | sub _generate_method { | ||||
| 40 | my $self = shift; | ||||
| 41 | |||||
| 42 | my $inv = '$self'; | ||||
| 43 | |||||
| 44 | my $slot_access = $self->_inline_get($inv); | ||||
| 45 | |||||
| 46 | my $code = 'sub {'; | ||||
| 47 | |||||
| 48 | $code .= "\n" . $self->_inline_pre_body(@_); | ||||
| 49 | $code .= "\n" . 'my $self = shift;'; | ||||
| 50 | |||||
| 51 | $code .= "\n" . $self->_inline_curried_arguments; | ||||
| 52 | |||||
| 53 | $code .= "\n" . 'if ( @_ == 1 || @_ == 2 ) {'; | ||||
| 54 | |||||
| 55 | $code .= $self->_reader_core( $inv, $slot_access ); | ||||
| 56 | |||||
| 57 | $code .= "\n" . '} elsif ( @_ == 3 ) {'; | ||||
| 58 | |||||
| 59 | $code .= $self->_writer_core( $inv, $slot_access ); | ||||
| 60 | |||||
| 61 | $code .= "\n" . $self->_inline_post_body(@_); | ||||
| 62 | |||||
| 63 | $code .= "\n" . '} else {'; | ||||
| 64 | |||||
| 65 | $code .= "\n" . $self->_inline_check_argument_count; | ||||
| 66 | |||||
| 67 | $code .= "\n" . '}'; | ||||
| 68 | $code .= "\n" . '}'; | ||||
| 69 | |||||
| 70 | return $code; | ||||
| 71 | } | ||||
| 72 | |||||
| 73 | sub _minimum_arguments {1} | ||||
| 74 | sub _maximum_arguments {3} | ||||
| 75 | |||||
| 76 | sub _inline_process_arguments { | ||||
| 77 | my ( $self, $inv, $slot_access ) = @_; | ||||
| 78 | |||||
| 79 | return | ||||
| 80 | 'my $offset = shift;' . "\n" | ||||
| 81 | . "my \$length = \@_ ? shift : length $slot_access;" . "\n" | ||||
| 82 | . 'my $replacement = shift;'; | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | sub _inline_check_arguments { | ||||
| 86 | my ( $self, $for_writer ) = @_; | ||||
| 87 | |||||
| 88 | my $code | ||||
| 89 | = $self->_inline_throw_error( | ||||
| 90 | q{'The first argument passed to substr must be an integer'}) | ||||
| 91 | . q{ unless $offset =~ /^-?\\d+$/;} . "\n" | ||||
| 92 | . $self->_inline_throw_error( | ||||
| 93 | q{'The second argument passed to substr must be an integer'}) | ||||
| 94 | . q{ unless $length =~ /^-?\\d+$/;}; | ||||
| 95 | |||||
| 96 | if ($for_writer) { | ||||
| 97 | $code | ||||
| 98 | .= "\n" | ||||
| 99 | . $self->_inline_throw_error( | ||||
| 100 | q{'The third argument passed to substr must be a string'}) | ||||
| 101 | . q{ unless Moose::Util::_STRINGLIKE0($replacement);}; | ||||
| 102 | } | ||||
| 103 | |||||
| 104 | return $code; | ||||
| 105 | } | ||||
| 106 | |||||
| 107 | sub _potential_value { | ||||
| 108 | my ( $self, $slot_access ) = @_; | ||||
| 109 | |||||
| 110 | return | ||||
| 111 | "( do { my \$potential = $slot_access; \@return = substr \$potential, \$offset, \$length, \$replacement; \$potential; } )"; | ||||
| 112 | } | ||||
| 113 | |||||
| 114 | sub _inline_optimized_set_new_value { | ||||
| 115 | my ( $self, $inv, $new, $slot_access ) = @_; | ||||
| 116 | |||||
| 117 | return "\@return = substr $slot_access, \$offset, \$length, \$replacement"; | ||||
| 118 | } | ||||
| 119 | |||||
| 120 | sub _return_value { | ||||
| 121 | my ( $self, $slot_access, $for_writer ) = @_; | ||||
| 122 | |||||
| 123 | return '$return[0]' if $for_writer; | ||||
| 124 | |||||
| 125 | return "substr $slot_access, \$offset, \$length"; | ||||
| 126 | } | ||||
| 127 | |||||
| 128 | 3 | 122µs | 2 | 1.55ms | # spent 800µs (49+751) within Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@128 which was called:
# once (49µs+751µs) by Moose::Meta::Attribute::Native::Trait::String::BEGIN@17 at line 128 # spent 800µs making 1 call to Moose::Meta::Method::Accessor::Native::String::substr::BEGIN@128
# spent 751µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:557] |
| 129 | |||||
| 130 | 1 | 52µs | 1; |