| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPI/Token/Regexp.pm |
| Statements | Executed 9 statements in 166µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 11µs | 22µs | PPI::Token::Regexp::BEGIN@45 |
| 1 | 1 | 1 | 7µs | 7µs | PPI::Token::Regexp::BEGIN@49 |
| 1 | 1 | 1 | 6µs | 34µs | PPI::Token::Regexp::BEGIN@48 |
| 1 | 1 | 1 | 3µs | 3µs | PPI::Token::Regexp::BEGIN@46 |
| 0 | 0 | 0 | 0s | 0s | PPI::Token::Regexp::get_delimiters |
| 0 | 0 | 0 | 0s | 0s | PPI::Token::Regexp::get_match_string |
| 0 | 0 | 0 | 0s | 0s | PPI::Token::Regexp::get_modifiers |
| 0 | 0 | 0 | 0s | 0s | PPI::Token::Regexp::get_substitute_string |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package PPI::Token::Regexp; | ||||
| 2 | |||||
| 3 | =pod | ||||
| 4 | |||||
| 5 | =head1 NAME | ||||
| 6 | |||||
| 7 | PPI::Token::Regexp - Regular expression abstract base class | ||||
| 8 | |||||
| 9 | =head1 INHERITANCE | ||||
| 10 | |||||
| 11 | PPI::Token::Regexp | ||||
| 12 | isa PPI::Token | ||||
| 13 | isa PPI::Element | ||||
| 14 | |||||
| 15 | =head1 DESCRIPTION | ||||
| 16 | |||||
| 17 | The C<PPI::Token::Regexp> class is never instantiated, and simply | ||||
| 18 | provides a common abstract base class for the three regular expression | ||||
| 19 | classes. These being: | ||||
| 20 | |||||
| 21 | =over 2 | ||||
| 22 | |||||
| 23 | =item m// - L<PPI::Token::Regexp::Match> | ||||
| 24 | |||||
| 25 | =item s/// - L<PPI::Token::Regexp::Substitute> | ||||
| 26 | |||||
| 27 | =item tr/// - L<PPI::Token::Regexp::Transliterate> | ||||
| 28 | |||||
| 29 | =back | ||||
| 30 | |||||
| 31 | The names are hopefully obvious enough not to have to explain what | ||||
| 32 | each class is. See their pages for more details. | ||||
| 33 | |||||
| 34 | To save some confusion, it's worth pointing out here that C<qr//> is | ||||
| 35 | B<not> a regular expression (which PPI takes to mean something that | ||||
| 36 | will actually examine or modify a string), but rather a quote-like | ||||
| 37 | operator that acts as a constructor for compiled L<Regexp> objects. | ||||
| 38 | |||||
| 39 | =head1 METHODS | ||||
| 40 | |||||
| 41 | The following methods are inherited by this class' offspring: | ||||
| 42 | |||||
| 43 | =cut | ||||
| 44 | |||||
| 45 | 2 | 17µs | 2 | 33µs | # spent 22µs (11+11) within PPI::Token::Regexp::BEGIN@45 which was called:
# once (11µs+11µs) by PPI::Token::Regexp::Match::BEGIN@46 at line 45 # spent 22µs making 1 call to PPI::Token::Regexp::BEGIN@45
# spent 11µs making 1 call to strict::import |
| 46 | 2 | 21µs | 1 | 3µs | # spent 3µs within PPI::Token::Regexp::BEGIN@46 which was called:
# once (3µs+0s) by PPI::Token::Regexp::Match::BEGIN@46 at line 46 # spent 3µs making 1 call to PPI::Token::Regexp::BEGIN@46 |
| 47 | |||||
| 48 | 2 | 26µs | 2 | 61µs | # spent 34µs (6+27) within PPI::Token::Regexp::BEGIN@48 which was called:
# once (6µs+27µs) by PPI::Token::Regexp::Match::BEGIN@46 at line 48 # spent 34µs making 1 call to PPI::Token::Regexp::BEGIN@48
# spent 27µs making 1 call to vars::import |
| 49 | # spent 7µs within PPI::Token::Regexp::BEGIN@49 which was called:
# once (7µs+0s) by PPI::Token::Regexp::Match::BEGIN@46 at line 52 | ||||
| 50 | 1 | 400ns | $VERSION = '1.215'; | ||
| 51 | 1 | 8µs | @ISA = 'PPI::Token'; | ||
| 52 | 1 | 92µs | 1 | 7µs | } # spent 7µs making 1 call to PPI::Token::Regexp::BEGIN@49 |
| 53 | |||||
| - - | |||||
| 58 | ##################################################################### | ||||
| 59 | # PPI::Token::Regexp Methods | ||||
| 60 | |||||
| 61 | =pod | ||||
| 62 | |||||
| 63 | =head2 get_match_string | ||||
| 64 | |||||
| 65 | The C<get_match_string> method returns the portion of the regexp that | ||||
| 66 | performs the match. | ||||
| 67 | |||||
| 68 | =cut | ||||
| 69 | |||||
| 70 | sub get_match_string { | ||||
| 71 | return $_[0]->_section_content( 0 ); | ||||
| 72 | } | ||||
| 73 | |||||
| 74 | =pod | ||||
| 75 | |||||
| 76 | =head2 get_substitute_string | ||||
| 77 | |||||
| 78 | The C<get_substitute_string> method returns the portion of the regexp | ||||
| 79 | that is substituted for the match, if any. If the regexp does not | ||||
| 80 | substitute, C<undef> is returned. | ||||
| 81 | |||||
| 82 | =cut | ||||
| 83 | |||||
| 84 | sub get_substitute_string { | ||||
| 85 | return $_[0]->_section_content( 1 ); | ||||
| 86 | } | ||||
| 87 | |||||
| 88 | =pod | ||||
| 89 | |||||
| 90 | =head2 get_modifiers | ||||
| 91 | |||||
| 92 | The C<get_modifiers> method returns the modifiers of the regexp. | ||||
| 93 | |||||
| 94 | =cut | ||||
| 95 | |||||
| 96 | sub get_modifiers { | ||||
| 97 | return $_[0]->_modifiers(); | ||||
| 98 | } | ||||
| 99 | |||||
| 100 | =pod | ||||
| 101 | |||||
| 102 | =head2 get_delimiters | ||||
| 103 | |||||
| 104 | The C<get_delimiters> method returns the delimiters of the regexp as | ||||
| 105 | an array. The first element is the delimiters of the match string, and | ||||
| 106 | the second element (if any) is the delimiters of the substitute string | ||||
| 107 | (if any). | ||||
| 108 | |||||
| 109 | =cut | ||||
| 110 | |||||
| 111 | sub get_delimiters { | ||||
| 112 | return $_[0]->_delimiters(); | ||||
| 113 | } | ||||
| 114 | |||||
| 115 | |||||
| 116 | 1 | 2µs | 1; | ||
| 117 | |||||
| 118 | =pod | ||||
| 119 | |||||
| 120 | =head1 SUPPORT | ||||
| 121 | |||||
| 122 | See the L<support section|PPI/SUPPORT> in the main module. | ||||
| 123 | |||||
| 124 | =head1 AUTHOR | ||||
| 125 | |||||
| 126 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||||
| 127 | |||||
| 128 | =head1 COPYRIGHT | ||||
| 129 | |||||
| 130 | Copyright 2001 - 2011 Adam Kennedy. | ||||
| 131 | |||||
| 132 | This program is free software; you can redistribute | ||||
| 133 | it and/or modify it under the same terms as Perl itself. | ||||
| 134 | |||||
| 135 | The full text of the license can be found in the | ||||
| 136 | LICENSE file included with this module. | ||||
| 137 | |||||
| 138 | =cut |