| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPIx/Regexp/Structure/Modifier.pm |
| Statements | Executed 8 statements in 125µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 11µs | 22µs | PPIx::Regexp::Structure::Modifier::BEGIN@33 |
| 1 | 1 | 1 | 7µs | 12µs | PPIx::Regexp::Structure::Modifier::BEGIN@34 |
| 1 | 1 | 1 | 6µs | 57µs | PPIx::Regexp::Structure::Modifier::BEGIN@36 |
| 0 | 0 | 0 | 0s | 0s | PPIx::Regexp::Structure::Modifier::__ducktype_modifier_asserted |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | =head1 NAME | ||||
| 2 | |||||
| 3 | PPIx::Regexp::Structure::Modifier - Represent modifying parentheses | ||||
| 4 | |||||
| 5 | =head1 SYNOPSIS | ||||
| 6 | |||||
| 7 | use PPIx::Regexp::Dumper; | ||||
| 8 | PPIx::Regexp::Dumper->new( 'qr{(?i:foo)}smx' ) | ||||
| 9 | ->print(); | ||||
| 10 | |||||
| 11 | =head1 INHERITANCE | ||||
| 12 | |||||
| 13 | C<PPIx::Regexp::Structure::Modifier> is a | ||||
| 14 | L<PPIx::Regexp::Structure|PPIx::Regexp::Structure>. | ||||
| 15 | |||||
| 16 | C<PPIx::Regexp::Structure::Modifier> has no descendants. | ||||
| 17 | |||||
| 18 | =head1 DESCRIPTION | ||||
| 19 | |||||
| 20 | This class represents parentheses that apply modifiers to their contents | ||||
| 21 | -- even if there are no modifiers. The latter is to say that C<(?:foo)> | ||||
| 22 | also ends up as this class. | ||||
| 23 | |||||
| 24 | =head1 METHODS | ||||
| 25 | |||||
| 26 | This class provides no public methods beyond those provided by its | ||||
| 27 | superclass. | ||||
| 28 | |||||
| 29 | =cut | ||||
| 30 | |||||
| 31 | package PPIx::Regexp::Structure::Modifier; | ||||
| 32 | |||||
| 33 | 2 | 19µs | 2 | 34µs | # spent 22µs (11+11) within PPIx::Regexp::Structure::Modifier::BEGIN@33 which was called:
# once (11µs+11µs) by PPIx::Regexp::Lexer::BEGIN@52 at line 33 # spent 22µs making 1 call to PPIx::Regexp::Structure::Modifier::BEGIN@33
# spent 11µs making 1 call to strict::import |
| 34 | 2 | 20µs | 2 | 16µs | # spent 12µs (7+4) within PPIx::Regexp::Structure::Modifier::BEGIN@34 which was called:
# once (7µs+4µs) by PPIx::Regexp::Lexer::BEGIN@52 at line 34 # spent 12µs making 1 call to PPIx::Regexp::Structure::Modifier::BEGIN@34
# spent 4µs making 1 call to warnings::import |
| 35 | |||||
| 36 | 2 | 84µs | 2 | 108µs | # spent 57µs (6+51) within PPIx::Regexp::Structure::Modifier::BEGIN@36 which was called:
# once (6µs+51µs) by PPIx::Regexp::Lexer::BEGIN@52 at line 36 # spent 57µs making 1 call to PPIx::Regexp::Structure::Modifier::BEGIN@36
# spent 51µs making 1 call to base::import |
| 37 | |||||
| 38 | 1 | 600ns | our $VERSION = '0.036'; | ||
| 39 | |||||
| 40 | # This is a kluge for both determining whether the object asserts | ||||
| 41 | # modifiers (hence the 'ductype') and determining whether the given | ||||
| 42 | # modifier is actually asserted. The signature is the invocant and the | ||||
| 43 | # modifier name, which must not be undef. The return is a boolean. | ||||
| 44 | sub __ducktype_modifier_asserted { | ||||
| 45 | my ( $self, $modifier ) = @_; | ||||
| 46 | foreach my $type ( reverse $self->type() ) { | ||||
| 47 | $type->can( '__ducktype_modifier_asserted' ) | ||||
| 48 | or next; | ||||
| 49 | defined( my $val = $type->__ducktype_modifier_asserted( $modifier ) ) | ||||
| 50 | or next; | ||||
| 51 | return $val; | ||||
| 52 | } | ||||
| 53 | return; | ||||
| 54 | } | ||||
| 55 | |||||
| 56 | 1 | 2µs | 1; | ||
| 57 | |||||
| 58 | __END__ |