← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:10 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPI/Token.pm
StatementsExecuted 561430 statements in 1.91s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
3571517119482ms482msPPI::Token::::contentPPI::Token::content
9422965231ms231msPPI::Token::::newPPI::Token::new
4507921124ms152msPPI::Token::::__LEXER__closesPPI::Token::__LEXER__closes
884521795.3ms114msPPI::Token::::set_classPPI::Token::set_class
116663269.5ms85.1msPPI::Token::::__LEXER__opensPPI::Token::__LEXER__opens
499424161.9ms61.9msPPI::Token::::CORE:matchPPI::Token::CORE:match (opcode)
1111.92ms13.7msPPI::Token::::BEGIN@25PPI::Token::BEGIN@25
1111.38ms1.85msPPI::Token::::BEGIN@24PPI::Token::BEGIN@24
1111.24ms1.42msPPI::Token::::BEGIN@39PPI::Token::BEGIN@39
1111.18ms1.28msPPI::Token::::BEGIN@49PPI::Token::BEGIN@49
111973µs1.09msPPI::Token::::BEGIN@70PPI::Token::BEGIN@70
111726µs2.05msPPI::Token::::BEGIN@53PPI::Token::BEGIN@53
111697µs793µsPPI::Token::::BEGIN@51PPI::Token::BEGIN@51
111571µs669µsPPI::Token::::BEGIN@75PPI::Token::BEGIN@75
111548µs671µsPPI::Token::::BEGIN@68PPI::Token::BEGIN@68
111438µs535µsPPI::Token::::BEGIN@41PPI::Token::BEGIN@41
111407µs477µsPPI::Token::::BEGIN@42PPI::Token::BEGIN@42
111376µs447µsPPI::Token::::BEGIN@48PPI::Token::BEGIN@48
111353µs421µsPPI::Token::::BEGIN@47PPI::Token::BEGIN@47
111350µs446µsPPI::Token::::BEGIN@74PPI::Token::BEGIN@74
111340µs417µsPPI::Token::::BEGIN@43PPI::Token::BEGIN@43
111338µs405µsPPI::Token::::BEGIN@46PPI::Token::BEGIN@46
111337µs1.48msPPI::Token::::BEGIN@55PPI::Token::BEGIN@55
111335µs431µsPPI::Token::::BEGIN@73PPI::Token::BEGIN@73
111331µs432µsPPI::Token::::BEGIN@66PPI::Token::BEGIN@66
111321µs388µsPPI::Token::::BEGIN@44PPI::Token::BEGIN@44
111318µs390µsPPI::Token::::BEGIN@40PPI::Token::BEGIN@40
111318µs387µsPPI::Token::::BEGIN@38PPI::Token::BEGIN@38
111302µs3.61msPPI::Token::::BEGIN@72PPI::Token::BEGIN@72
111274µs345µsPPI::Token::::BEGIN@50PPI::Token::BEGIN@50
111272µs350µsPPI::Token::::BEGIN@26PPI::Token::BEGIN@26
111262µs331µsPPI::Token::::BEGIN@45PPI::Token::BEGIN@45
111248µs319µsPPI::Token::::BEGIN@60PPI::Token::BEGIN@60
111246µs364µsPPI::Token::::BEGIN@71PPI::Token::BEGIN@71
14411224µs224µsPPI::Token::::__TOKENIZER__on_line_endPPI::Token::__TOKENIZER__on_line_end
111222µs1.62msPPI::Token::::BEGIN@56PPI::Token::BEGIN@56
111221µs296µsPPI::Token::::BEGIN@52PPI::Token::BEGIN@52
111213µs286µsPPI::Token::::BEGIN@61PPI::Token::BEGIN@61
111201µs276µsPPI::Token::::BEGIN@57PPI::Token::BEGIN@57
111184µs251µsPPI::Token::::BEGIN@67PPI::Token::BEGIN@67
111174µs246µsPPI::Token::::BEGIN@62PPI::Token::BEGIN@62
111166µs514µsPPI::Token::::BEGIN@63PPI::Token::BEGIN@63
111162µs246µsPPI::Token::::BEGIN@59PPI::Token::BEGIN@59
111162µs244µsPPI::Token::::BEGIN@64PPI::Token::BEGIN@64
111158µs447µsPPI::Token::::BEGIN@58PPI::Token::BEGIN@58
111158µs235µsPPI::Token::::BEGIN@65PPI::Token::BEGIN@65
111143µs208µsPPI::Token::::BEGIN@69PPI::Token::BEGIN@69
11116µs16µsPPI::Token::::BEGIN@29PPI::Token::BEGIN@29
11110µs21µsPPI::Token::::BEGIN@23PPI::Token::BEGIN@23
1117µs55µsPPI::Token::::BEGIN@28PPI::Token::BEGIN@28
1115µs5µsPPI::Token::::BEGIN@76PPI::Token::BEGIN@76
1114µs4µsPPI::Token::::BEGIN@54PPI::Token::BEGIN@54
0000s0sPPI::Token::::__TOKENIZER__on_charPPI::Token::__TOKENIZER__on_char
0000s0sPPI::Token::::__TOKENIZER__on_line_startPPI::Token::__TOKENIZER__on_line_start
0000s0sPPI::Token::::add_contentPPI::Token::add_content
0000s0sPPI::Token::::insert_afterPPI::Token::insert_after
0000s0sPPI::Token::::insert_beforePPI::Token::insert_before
0000s0sPPI::Token::::lengthPPI::Token::length
0000s0sPPI::Token::::set_contentPPI::Token::set_content
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package PPI::Token;
2
3=pod
4
5=head1 NAME
6
7PPI::Token - A single token of Perl source code
8
9=head1 INHERITANCE
10
11 PPI::Token
12 isa PPI::Element
13
14=head1 DESCRIPTION
15
16C<PPI::Token> is the abstract base class for all Tokens. In PPI terms, a "Token" is
17a L<PPI::Element> that directly represents bytes of source code.
18
19=head1 METHODS
20
21=cut
22
23223µs231µs
# spent 21µs (10+11) within PPI::Token::BEGIN@23 which was called: # once (10µs+11µs) by PPI::Token::Quote::BEGIN@49 at line 23
use strict;
# spent 21µs making 1 call to PPI::Token::BEGIN@23 # spent 11µs making 1 call to strict::import
24295µs21.93ms
# spent 1.85ms (1.38+478µs) within PPI::Token::BEGIN@24 which was called: # once (1.38ms+478µs) by PPI::Token::Quote::BEGIN@49 at line 24
use Params::Util qw{_INSTANCE};
# spent 1.85ms making 1 call to PPI::Token::BEGIN@24 # spent 73µs making 1 call to Exporter::import
25292µs113.7ms
# spent 13.7ms (1.92+11.8) within PPI::Token::BEGIN@25 which was called: # once (1.92ms+11.8ms) by PPI::Token::Quote::BEGIN@49 at line 25
use PPI::Element ();
# spent 13.7ms making 1 call to PPI::Token::BEGIN@25
26279µs1350µs
# spent 350µs (272+79) within PPI::Token::BEGIN@26 which was called: # once (272µs+79µs) by PPI::Token::Quote::BEGIN@49 at line 26
use PPI::Exception ();
# spent 350µs making 1 call to PPI::Token::BEGIN@26
27
28246µs2104µs
# spent 55µs (7+48) within PPI::Token::BEGIN@28 which was called: # once (7µs+48µs) by PPI::Token::Quote::BEGIN@49 at line 28
use vars qw{$VERSION @ISA};
# spent 55µs making 1 call to PPI::Token::BEGIN@28 # spent 48µs making 1 call to vars::import
29
# spent 16µs within PPI::Token::BEGIN@29 which was called: # once (16µs+0s) by PPI::Token::Quote::BEGIN@49 at line 32
BEGIN {
301400ns $VERSION = '1.215';
3118µs @ISA = 'PPI::Element';
32116µs116µs}
# spent 16µs making 1 call to PPI::Token::BEGIN@29
33
34# We don't load the abstracts, they are loaded
35# as part of the inheritance process.
36
37# Load the token classes
382101µs1387µs
# spent 387µs (318+69) within PPI::Token::BEGIN@38 which was called: # once (318µs+69µs) by PPI::Token::Quote::BEGIN@49 at line 38
use PPI::Token::BOM ();
# spent 387µs making 1 call to PPI::Token::BEGIN@38
39298µs11.42ms
# spent 1.42ms (1.24+187µs) within PPI::Token::BEGIN@39 which was called: # once (1.24ms+187µs) by PPI::Token::Quote::BEGIN@49 at line 39
use PPI::Token::Whitespace ();
# spent 1.42ms making 1 call to PPI::Token::BEGIN@39
402100µs1390µs
# spent 390µs (318+72) within PPI::Token::BEGIN@40 which was called: # once (318µs+72µs) by PPI::Token::Quote::BEGIN@49 at line 40
use PPI::Token::Comment ();
# spent 390µs making 1 call to PPI::Token::BEGIN@40
41289µs1535µs
# spent 535µs (438+97) within PPI::Token::BEGIN@41 which was called: # once (438µs+97µs) by PPI::Token::Quote::BEGIN@49 at line 41
use PPI::Token::Pod ();
# spent 535µs making 1 call to PPI::Token::BEGIN@41
42291µs1477µs
# spent 477µs (407+70) within PPI::Token::BEGIN@42 which was called: # once (407µs+70µs) by PPI::Token::Quote::BEGIN@49 at line 42
use PPI::Token::Number ();
# spent 477µs making 1 call to PPI::Token::BEGIN@42
43288µs1417µs
# spent 417µs (340+77) within PPI::Token::BEGIN@43 which was called: # once (340µs+77µs) by PPI::Token::Quote::BEGIN@49 at line 43
use PPI::Token::Number::Binary ();
# spent 417µs making 1 call to PPI::Token::BEGIN@43
44289µs1388µs
# spent 388µs (321+68) within PPI::Token::BEGIN@44 which was called: # once (321µs+68µs) by PPI::Token::Quote::BEGIN@49 at line 44
use PPI::Token::Number::Octal ();
# spent 388µs making 1 call to PPI::Token::BEGIN@44
452126µs1331µs
# spent 331µs (262+69) within PPI::Token::BEGIN@45 which was called: # once (262µs+69µs) by PPI::Token::Quote::BEGIN@49 at line 45
use PPI::Token::Number::Hex ();
# spent 331µs making 1 call to PPI::Token::BEGIN@45
46288µs1405µs
# spent 405µs (338+66) within PPI::Token::BEGIN@46 which was called: # once (338µs+66µs) by PPI::Token::Quote::BEGIN@49 at line 46
use PPI::Token::Number::Float ();
# spent 405µs making 1 call to PPI::Token::BEGIN@46
47287µs1421µs
# spent 421µs (353+68) within PPI::Token::BEGIN@47 which was called: # once (353µs+68µs) by PPI::Token::Quote::BEGIN@49 at line 47
use PPI::Token::Number::Exp ();
# spent 421µs making 1 call to PPI::Token::BEGIN@47
48292µs1447µs
# spent 447µs (376+71) within PPI::Token::BEGIN@48 which was called: # once (376µs+71µs) by PPI::Token::Quote::BEGIN@49 at line 48
use PPI::Token::Number::Version ();
# spent 447µs making 1 call to PPI::Token::BEGIN@48
49297µs11.28ms
# spent 1.28ms (1.18+91µs) within PPI::Token::BEGIN@49 which was called: # once (1.18ms+91µs) by PPI::Token::Quote::BEGIN@49 at line 49
use PPI::Token::Word ();
# spent 1.28ms making 1 call to PPI::Token::BEGIN@49
50294µs1345µs
# spent 345µs (274+71) within PPI::Token::BEGIN@50 which was called: # once (274µs+71µs) by PPI::Token::Quote::BEGIN@49 at line 50
use PPI::Token::DashedWord ();
# spent 345µs making 1 call to PPI::Token::BEGIN@50
51288µs1793µs
# spent 793µs (697+97) within PPI::Token::BEGIN@51 which was called: # once (697µs+97µs) by PPI::Token::Quote::BEGIN@49 at line 51
use PPI::Token::Symbol ();
# spent 793µs making 1 call to PPI::Token::BEGIN@51
52286µs1296µs
# spent 296µs (221+75) within PPI::Token::BEGIN@52 which was called: # once (221µs+75µs) by PPI::Token::Quote::BEGIN@49 at line 52
use PPI::Token::ArrayIndex ();
# spent 296µs making 1 call to PPI::Token::BEGIN@52
532100µs12.05ms
# spent 2.05ms (726µs+1.33) within PPI::Token::BEGIN@53 which was called: # once (726µs+1.33ms) by PPI::Token::Quote::BEGIN@49 at line 53
use PPI::Token::Magic ();
# spent 2.05ms making 1 call to PPI::Token::BEGIN@53
54222µs14µs
# spent 4µs within PPI::Token::BEGIN@54 which was called: # once (4µs+0s) by PPI::Token::Quote::BEGIN@49 at line 54
use PPI::Token::Quote::Single ();
# spent 4µs making 1 call to PPI::Token::BEGIN@54
552102µs11.48ms
# spent 1.48ms (337µs+1.14) within PPI::Token::BEGIN@55 which was called: # once (337µs+1.14ms) by PPI::Token::Quote::BEGIN@49 at line 55
use PPI::Token::Quote::Double ();
# spent 1.48ms making 1 call to PPI::Token::BEGIN@55
56292µs11.62ms
# spent 1.62ms (222µs+1.39) within PPI::Token::BEGIN@56 which was called: # once (222µs+1.39ms) by PPI::Token::Quote::BEGIN@49 at line 56
use PPI::Token::Quote::Literal ();
# spent 1.62ms making 1 call to PPI::Token::BEGIN@56
57291µs1276µs
# spent 276µs (201+75) within PPI::Token::BEGIN@57 which was called: # once (201µs+75µs) by PPI::Token::Quote::BEGIN@49 at line 57
use PPI::Token::Quote::Interpolate ();
# spent 276µs making 1 call to PPI::Token::BEGIN@57
58292µs1447µs
# spent 447µs (158+288) within PPI::Token::BEGIN@58 which was called: # once (158µs+288µs) by PPI::Token::Quote::BEGIN@49 at line 58
use PPI::Token::QuoteLike::Backtick ();
# spent 447µs making 1 call to PPI::Token::BEGIN@58
592101µs1246µs
# spent 246µs (162+84) within PPI::Token::BEGIN@59 which was called: # once (162µs+84µs) by PPI::Token::Quote::BEGIN@49 at line 59
use PPI::Token::QuoteLike::Command ();
# spent 246µs making 1 call to PPI::Token::BEGIN@59
60285µs1319µs
# spent 319µs (248+71) within PPI::Token::BEGIN@60 which was called: # once (248µs+71µs) by PPI::Token::Quote::BEGIN@49 at line 60
use PPI::Token::QuoteLike::Regexp ();
# spent 319µs making 1 call to PPI::Token::BEGIN@60
61288µs1286µs
# spent 286µs (213+73) within PPI::Token::BEGIN@61 which was called: # once (213µs+73µs) by PPI::Token::Quote::BEGIN@49 at line 61
use PPI::Token::QuoteLike::Words ();
# spent 286µs making 1 call to PPI::Token::BEGIN@61
62295µs1246µs
# spent 246µs (174+72) within PPI::Token::BEGIN@62 which was called: # once (174µs+72µs) by PPI::Token::Quote::BEGIN@49 at line 62
use PPI::Token::QuoteLike::Readline ();
# spent 246µs making 1 call to PPI::Token::BEGIN@62
632104µs1514µs
# spent 514µs (166+348) within PPI::Token::BEGIN@63 which was called: # once (166µs+348µs) by PPI::Token::Quote::BEGIN@49 at line 63
use PPI::Token::Regexp::Match ();
# spent 514µs making 1 call to PPI::Token::BEGIN@63
64291µs1244µs
# spent 244µs (162+82) within PPI::Token::BEGIN@64 which was called: # once (162µs+82µs) by PPI::Token::Quote::BEGIN@49 at line 64
use PPI::Token::Regexp::Substitute ();
# spent 244µs making 1 call to PPI::Token::BEGIN@64
65299µs1235µs
# spent 235µs (158+77) within PPI::Token::BEGIN@65 which was called: # once (158µs+77µs) by PPI::Token::Quote::BEGIN@49 at line 65
use PPI::Token::Regexp::Transliterate ();
# spent 235µs making 1 call to PPI::Token::BEGIN@65
66299µs1432µs
# spent 432µs (331+102) within PPI::Token::BEGIN@66 which was called: # once (331µs+102µs) by PPI::Token::Quote::BEGIN@49 at line 66
use PPI::Token::Operator ();
# spent 432µs making 1 call to PPI::Token::BEGIN@66
67293µs1251µs
# spent 251µs (184+67) within PPI::Token::BEGIN@67 which was called: # once (184µs+67µs) by PPI::Token::Quote::BEGIN@49 at line 67
use PPI::Token::Cast ();
# spent 251µs making 1 call to PPI::Token::BEGIN@67
68293µs1671µs
# spent 671µs (548+124) within PPI::Token::BEGIN@68 which was called: # once (548µs+124µs) by PPI::Token::Quote::BEGIN@49 at line 68
use PPI::Token::Structure ();
# spent 671µs making 1 call to PPI::Token::BEGIN@68
6924.80ms1208µs
# spent 208µs (143+66) within PPI::Token::BEGIN@69 which was called: # once (143µs+66µs) by PPI::Token::Quote::BEGIN@49 at line 69
use PPI::Token::Label ();
# spent 208µs making 1 call to PPI::Token::BEGIN@69
702214µs11.09ms
# spent 1.09ms (973µs+122µs) within PPI::Token::BEGIN@70 which was called: # once (973µs+122µs) by PPI::Token::Quote::BEGIN@49 at line 70
use PPI::Token::HereDoc ();
# spent 1.09ms making 1 call to PPI::Token::BEGIN@70
712162µs1364µs
# spent 364µs (246+118) within PPI::Token::BEGIN@71 which was called: # once (246µs+118µs) by PPI::Token::Quote::BEGIN@49 at line 71
use PPI::Token::Separator ();
# spent 364µs making 1 call to PPI::Token::BEGIN@71
722150µs13.61ms
# spent 3.61ms (302µs+3.30) within PPI::Token::BEGIN@72 which was called: # once (302µs+3.30ms) by PPI::Token::Quote::BEGIN@49 at line 72
use PPI::Token::Data ();
# spent 3.61ms making 1 call to PPI::Token::BEGIN@72
732138µs1431µs
# spent 431µs (335+95) within PPI::Token::BEGIN@73 which was called: # once (335µs+95µs) by PPI::Token::Quote::BEGIN@49 at line 73
use PPI::Token::End ();
# spent 431µs making 1 call to PPI::Token::BEGIN@73
742141µs1446µs
# spent 446µs (350+96) within PPI::Token::BEGIN@74 which was called: # once (350µs+96µs) by PPI::Token::Quote::BEGIN@49 at line 74
use PPI::Token::Prototype ();
# spent 446µs making 1 call to PPI::Token::BEGIN@74
752145µs1669µs
# spent 669µs (571+98) within PPI::Token::BEGIN@75 which was called: # once (571µs+98µs) by PPI::Token::Quote::BEGIN@49 at line 75
use PPI::Token::Attribute ();
# spent 669µs making 1 call to PPI::Token::BEGIN@75
762838µs15µs
# spent 5µs within PPI::Token::BEGIN@76 which was called: # once (5µs+0s) by PPI::Token::Quote::BEGIN@49 at line 76
use PPI::Token::Unknown ();
# spent 5µs making 1 call to PPI::Token::BEGIN@76
77
- -
82#####################################################################
83# Constructor and Related
84
85
# spent 231ms within PPI::Token::new which was called 94229 times, avg 2µs/call: # 53790 times (138ms+0s) by PPI::Tokenizer::_new_token at line 623 of PPI/Tokenizer.pm, avg 3µs/call # 37692 times (85.7ms+0s) by PPI::Tokenizer::_process_next_char at line 584 of PPI/Tokenizer.pm, avg 2µs/call # 1682 times (4.04ms+0s) by PPI::Token::_QuoteEngine::Simple::new at line 22 of PPI/Token/_QuoteEngine/Simple.pm, avg 2µs/call # 1061 times (2.87ms+0s) by PPI::Token::_QuoteEngine::Full::new at line 149 of PPI/Token/_QuoteEngine/Full.pm, avg 3µs/call # 3 times (9µs+0s) by PPI::Token::Magic::__TOKENIZER__on_char at line 175 of PPI/Token/Magic.pm, avg 3µs/call # once (8µs+0s) by PPI::Token::Whitespace::null at line 79 of PPI/Token/Whitespace.pm
sub new {
8694229412ms bless { content => (defined $_[1] ? "$_[1]" : '') }, $_[0];
87}
88
89
# spent 114ms (95.3+18.4) within PPI::Token::set_class which was called 8845 times, avg 13µs/call: # 6802 times (73.3ms+14.1ms) by PPI::Token::Unknown::__TOKENIZER__on_char at line 128 of PPI/Token/Unknown.pm, avg 13µs/call # 803 times (5.47ms+1.59ms) by PPI::Token::Unknown::__TOKENIZER__on_char at line 157 of PPI/Token/Unknown.pm, avg 9µs/call # 509 times (3.16ms+913µs) by PPI::Token::Symbol::__TOKENIZER__on_char at line 173 of PPI/Token/Symbol.pm, avg 8µs/call # 150 times (4.98ms+522µs) by PPI::Token::Number::__TOKENIZER__on_char at line 115 of PPI/Token/Number.pm, avg 37µs/call # 139 times (5.21ms+291µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 247 of PPI/Token/Unknown.pm, avg 40µs/call # 119 times (896µs+252µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 199 of PPI/Token/Unknown.pm, avg 10µs/call # 108 times (724µs+228µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 271 of PPI/Token/Unknown.pm, avg 9µs/call # 85 times (622µs+170µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 178 of PPI/Token/Unknown.pm, avg 9µs/call # 34 times (250µs+69µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 134 of PPI/Token/Unknown.pm, avg 9µs/call # 28 times (208µs+55µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 236 of PPI/Token/Unknown.pm, avg 9µs/call # 25 times (158µs+54µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 294 of PPI/Token/Unknown.pm, avg 8µs/call # 22 times (146µs+37µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 215 of PPI/Token/Unknown.pm, avg 8µs/call # 9 times (61µs+17µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 255 of PPI/Token/Unknown.pm, avg 9µs/call # 2 times (16µs+5µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 60 of PPI/Token/Unknown.pm, avg 10µs/call # 2 times (13µs+4µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 266 of PPI/Token/Unknown.pm, avg 8µs/call # 2 times (12µs+4µs) by PPI::Token::Number::Float::__TOKENIZER__on_char at line 92 of PPI/Token/Number/Float.pm, avg 8µs/call # 2 times (12µs+3µs) by PPI::Token::DashedWord::__TOKENIZER__on_char at line 87 of PPI/Token/DashedWord.pm, avg 8µs/call # once (7µs+2µs) by PPI::Token::Operator::__TOKENIZER__on_char at line 101 of PPI/Token/Operator.pm # once (7µs+2µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 221 of PPI/Token/Unknown.pm # once (6µs+2µs) by PPI::Token::Unknown::__TOKENIZER__on_char at line 149 of PPI/Token/Unknown.pm # once (6µs+2µs) by PPI::Token::Magic::__TOKENIZER__on_char at line 169 of PPI/Token/Magic.pm
sub set_class {
9088452.04ms my $self = shift;
91 # @_ or throw Exception("No arguments to set_class");
9288455.21ms my $class = substr( $_[0], 0, 12 ) eq 'PPI::Token::' ? shift : 'PPI::Token::' . shift;
93
94 # Find out if the current and new classes are complex
95884551.3ms884510.3ms my $old_quote = (ref($self) =~ /\b(?:Quote|Regex)\b/o) ? 1 : 0;
# spent 10.3ms making 8845 calls to PPI::Token::CORE:match, avg 1µs/call
96884529.9ms88458.01ms my $new_quote = ($class =~ /\b(?:Quote|Regex)\b/o) ? 1 : 0;
# spent 8.01ms making 8845 calls to PPI::Token::CORE:match, avg 906ns/call
97
98 # No matter what happens, we will have to rebless
9988455.10ms bless $self, $class;
100
101 # If we are changing to or from a Quote style token, we
102 # can't just rebless and need to do some extra thing
103 # Otherwise, we have done enough
104884533.0ms return $class if ($old_quote - $new_quote) == 0;
105
106 # Make a new token from the old content, and overwrite the current
107 # token's attributes with the new token's attributes.
108 my $token = $class->new( $self->{content} );
109 %$self = %$token;
110
111 # Return the class as a convenience
112 return $class;
113}
114
- -
119#####################################################################
120# PPI::Token Methods
121
122=pod
123
124=head2 set_content $string
125
126The C<set_content> method allows to set/change the string that the
127C<PPI::Token> object represents.
128
129Returns the string you set the Token to
130
131=cut
132
133sub set_content {
134 $_[0]->{content} = $_[1];
135}
136
137=pod
138
139=head2 add_content $string
140
141The C<add_content> method allows you to add additional bytes of code
142to the end of the Token.
143
144Returns the new full string after the bytes have been added.
145
146=cut
147
148sub add_content { $_[0]->{content} .= $_[1] }
149
150=pod
151
152=head2 length
153
154The C<length> method returns the length of the string in a Token.
155
156=cut
157
158sub length { CORE::length($_[0]->{content}) }
159
- -
164#####################################################################
165# Overloaded PPI::Element methods
166
167
# spent 482ms within PPI::Token::content which was called 357151 times, avg 1µs/call: # 105472 times (141ms+0s) by PPI::Element::__eq at line 1089 of PPI/Element.pm, avg 1µs/call # 94224 times (133ms+0s) by PPI::Document::serialize at line 435 of PPI/Document.pm, avg 1µs/call # 16707 times (19.6ms+0s) by Readonly::Hash::EXISTS at line 25 of Readonly/Hash.pm, avg 1µs/call # 13481 times (16.4ms+0s) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates at line 46 of Perl/Critic/Policy/InputOutput/RequireEncodingWithUTF8Layer.pm, avg 1µs/call # 13481 times (14.9ms+0s) by Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::violates at line 100 of Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm, avg 1µs/call # 11219 times (14.7ms+0s) by Perl::Critic::Policy::Variables::ProhibitConditionalDeclarations::_is_conditional at line 50 of Perl/Critic/Policy/Variables/ProhibitConditionalDeclarations.pm, avg 1µs/call # 10732 times (14.8ms+0s) by PPI::Lexer::_lex_statement at line 641 of PPI/Lexer.pm, avg 1µs/call # 10331 times (14.6ms+0s) by PPI::Lexer::_statement at line 456 of PPI/Lexer.pm, avg 1µs/call # 9353 times (13.9ms+0s) by Perl::Critic::Utils::McCabe::_count_logic_keywords at line 113 of Perl/Critic/Utils/McCabe.pm, avg 1µs/call # 7954 times (10.4ms+0s) by PPI::Node::content at line 671 of PPI/Node.pm, avg 1µs/call # 7354 times (11.0ms+0s) by Perl::Critic::Utils::McCabe::_count_logic_operators at line 130 of Perl/Critic/Utils/McCabe.pm, avg 1µs/call # 5818 times (7.37ms+0s) by PPI::Lexer::_statement at line 497 of PPI/Lexer.pm, avg 1µs/call # 5789 times (8.10ms+0s) by PPI::Lexer::_lex_structure at line 1356 of PPI/Lexer.pm, avg 1µs/call # 5789 times (7.12ms+0s) by PPI::Lexer::_lex_statement at line 649 of PPI/Lexer.pm, avg 1µs/call # 4796 times (6.04ms+0s) by PPI::Lexer::_statement at line 539 of PPI/Lexer.pm, avg 1µs/call # 3024 times (4.79ms+0s) by PPI::Lexer::_lex_document at line 277 of PPI/Lexer.pm, avg 2µs/call # 2953 times (4.52ms+0s) by PPI::Token::Whitespace::__TOKENIZER__on_char at line 248 of PPI/Token/Whitespace.pm, avg 2µs/call # 2953 times (3.91ms+0s) by PPI::Lexer::_round at line 993 of PPI/Lexer.pm, avg 1µs/call # 2598 times (3.66ms+0s) by PPI::Statement::Variable::type at line 73 of PPI/Statement/Variable.pm, avg 1µs/call # 2334 times (3.40ms+0s) by PPI::Statement::Compound::type at line 202 of PPI/Statement/Compound.pm, avg 1µs/call # 2244 times (2.97ms+0s) by PPI::Structure::content at line 291 of PPI/Structure.pm, avg 1µs/call # 2244 times (2.87ms+0s) by PPI::Structure::content at line 295 of PPI/Structure.pm, avg 1µs/call # 2219 times (3.02ms+0s) by PPI::Structure::content at line 293 of PPI/Structure.pm, avg 1µs/call # 1910 times (3.00ms+0s) by Perl::Critic::Annotation::CORE:match at line 36 of Perl/Critic/Annotation.pm, avg 2µs/call # 1668 times (2.55ms+0s) by PPI::Document::_logical_line_and_file at line 690 of PPI/Document.pm, avg 2µs/call # 1644 times (2.17ms+0s) by PPI::Lexer::_curly at line 1190 of PPI/Lexer.pm, avg 1µs/call # 1268 times (1.76ms+0s) by PPI::Statement::Include::type at line 93 of PPI/Statement/Include.pm, avg 1µs/call # 1022 times (1.36ms+0s) by PPI::Lexer::_statement at line 508 of PPI/Lexer.pm, avg 1µs/call # 984 times (1.36ms+0s) by PPI::Statement::Include::module at line 126 of PPI/Statement/Include.pm, avg 1µs/call # 981 times (1.45ms+0s) by PPI::Lexer::_statement at line 551 of PPI/Lexer.pm, avg 1µs/call # 536 times (693µs+0s) by PPI::Lexer::_continues at line 764 of PPI/Lexer.pm, avg 1µs/call # 482 times (646µs+0s) by PPI::Statement::Compound::type at line 206 of PPI/Statement/Compound.pm, avg 1µs/call # 426 times (709µs+0s) by PPI::Statement::Include::version at line 267 of PPI/Statement/Include.pm, avg 2µs/call # 276 times (340µs+0s) by PPI::Lexer::_continues at line 928 of PPI/Lexer.pm, avg 1µs/call # 240 times (332µs+0s) by PPI::Lexer::_square at line 1031 of PPI/Lexer.pm, avg 1µs/call # 232 times (307µs+0s) by PPI::Lexer::_continues at line 859 of PPI/Lexer.pm, avg 1µs/call # 154 times (212µs+0s) by Perl::Critic::Utils::_name_for_sub_or_stringified_element at line 356 of Perl/Critic/Utils.pm, avg 1µs/call # 153 times (247µs+0s) by PPI::Tokenizer::_opcontext at line 747 of PPI/Tokenizer.pm, avg 2µs/call # 151 times (209µs+0s) by PPI::Lexer::_continues at line 805 of PPI/Lexer.pm, avg 1µs/call # 146 times (318µs+0s) by PPI::Document::_logical_line_and_file at line 705 of PPI/Document.pm, avg 2µs/call # 144 times (228µs+0s) by PPI::Statement::Package::namespace at line 95 of PPI/Statement/Package.pm, avg 2µs/call # 140 times (210µs+0s) by PPI::Lexer::_statement at line 437 of PPI/Lexer.pm, avg 2µs/call # 124 times (151µs+0s) by PPI::Lexer::_continues at line 893 of PPI/Lexer.pm, avg 1µs/call # 122 times (178µs+0s) by PPI::Lexer::_curly at line 1270 of PPI/Lexer.pm, avg 1µs/call # 119 times (185µs+0s) by PPI::Lexer::_continues at line 885 of PPI/Lexer.pm, avg 2µs/call # 116 times (178µs+0s) by PPI::Token::Whitespace::__TOKENIZER__on_char at line 227 of PPI/Token/Whitespace.pm, avg 2µs/call # 111 times (152µs+0s) by PPI::Lexer::_square at line 1040 of PPI/Lexer.pm, avg 1µs/call # 107 times (140µs+0s) by PPI::Tokenizer::_opcontext at line 753 of PPI/Tokenizer.pm, avg 1µs/call # 96 times (130µs+0s) by PPI::Lexer::_round at line 1011 of PPI/Lexer.pm, avg 1µs/call # 83 times (104µs+0s) by PPI::Lexer::_continues at line 923 of PPI/Lexer.pm, avg 1µs/call # 83 times (99µs+0s) by PPI::Lexer::_continues at line 930 of PPI/Lexer.pm, avg 1µs/call # 83 times (99µs+0s) by PPI::Lexer::_continues at line 959 of PPI/Lexer.pm, avg 1µs/call # 83 times (96µs+0s) by PPI::Lexer::_continues at line 952 of PPI/Lexer.pm, avg 1µs/call # 54 times (74µs+0s) by PPI::Lexer::_curly at line 1254 of PPI/Lexer.pm, avg 1µs/call # 51 times (81µs+0s) by Perl::Critic::Annotation::CORE:match at line 73 of Perl/Critic/Annotation.pm, avg 2µs/call # 51 times (77µs+0s) by Perl::Critic::Annotation::CORE:match at line 247 of Perl/Critic/Annotation.pm, avg 2µs/call # 50 times (70µs+0s) by Perl::Critic::Utils::precedence_of at line 701 of Perl/Critic/Utils.pm, avg 1µs/call # 38 times (54µs+0s) by Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::_is_assignment_operator at line 245 of Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm, avg 1µs/call # 33 times (42µs+0s) by PPI::Lexer::_continues at line 817 of PPI/Lexer.pm, avg 1µs/call # 23 times (35µs+0s) by Perl::Critic::Annotation::CORE:match at line 110 of Perl/Critic/Annotation.pm, avg 2µs/call # 19 times (27µs+0s) by PPI::Token::Whitespace::__TOKENIZER__on_char at line 285 of PPI/Token/Whitespace.pm, avg 1µs/call # 19 times (22µs+0s) by Perl::Critic::Policy::ControlStructures::ProhibitMutatingListFunctions::_is_increment_operator at line 248 of Perl/Critic/Policy/ControlStructures/ProhibitMutatingListFunctions.pm, avg 1µs/call # 18 times (25µs+0s) by PPI::Lexer::_continues at line 751 of PPI/Lexer.pm, avg 1µs/call # 14 times (20µs+0s) by PPI::Lexer::_continues at line 788 of PPI/Lexer.pm, avg 1µs/call # 12 times (17µs+0s) by Perl::Critic::Utils::CORE:match at line 771 of Perl/Critic/Utils.pm, avg 1µs/call # 6 times (7µs+0s) by PPI::Lexer::_continues at line 823 of PPI/Lexer.pm, avg 1µs/call # 5 times (8µs+0s) by Perl::Critic::Policy::BuiltinFunctions::RequireGlobFunction::CORE:match at line 38 of Perl/Critic/Policy/BuiltinFunctions/RequireGlobFunction.pm, avg 2µs/call # 2 times (3µs+0s) by PPI::Lexer::_continues at line 876 of PPI/Lexer.pm, avg 1µs/call # once (2µs+0s) by PPI::Token::Whitespace::__TOKENIZER__on_char at line 322 of PPI/Token/Whitespace.pm # once (1µs+0s) by PPI::Document::serialize at line 461 of PPI/Document.pm # once (1µs+0s) by PPI::Lexer::_curly at line 1212 of PPI/Lexer.pm
sub content {
168357151999ms $_[0]->{content};
169}
170
171# You can insert either a statement, or a non-significant token.
172sub insert_before {
173 my $self = shift;
174 my $Element = _INSTANCE(shift, 'PPI::Element') or return undef;
175 if ( $Element->isa('PPI::Structure') ) {
176 return $self->__insert_before($Element);
177 } elsif ( $Element->isa('PPI::Token') ) {
178 return $self->__insert_before($Element);
179 }
180 '';
181}
182
183# As above, you can insert a statement, or a non-significant token
184sub insert_after {
185 my $self = shift;
186 my $Element = _INSTANCE(shift, 'PPI::Element') or return undef;
187 if ( $Element->isa('PPI::Structure') ) {
188 return $self->__insert_after($Element);
189 } elsif ( $Element->isa('PPI::Token') ) {
190 return $self->__insert_after($Element);
191 }
192 '';
193}
194
- -
199#####################################################################
200# Tokenizer Methods
201
202sub __TOKENIZER__on_line_start { 1 }
203144288µs
# spent 224µs within PPI::Token::__TOKENIZER__on_line_end which was called 144 times, avg 2µs/call: # 144 times (224µs+0s) by PPI::Tokenizer::_process_next_line at line 518 of PPI/Tokenizer.pm, avg 2µs/call
sub __TOKENIZER__on_line_end { 1 }
204sub __TOKENIZER__on_char { 'Unknown' }
205
- -
210#####################################################################
211# Lexer Methods
212
213
# spent 85.1ms (69.5+15.7) within PPI::Token::__LEXER__opens which was called 11666 times, avg 7µs/call: # 5871 times (23.6ms+5.72ms) by PPI::Lexer::_lex_structure at line 1344 of PPI/Lexer.pm, avg 5µs/call # 5789 times (45.9ms+9.95ms) by PPI::Structure::new at line 123 of PPI/Structure.pm, avg 10µs/call # 6 times (23µs+15µs) by PPI::Lexer::_lex_document at line 301 of PPI/Lexer.pm, avg 6µs/call
sub __LEXER__opens {
21411666106ms1166615.7ms ref($_[0]) eq 'PPI::Token::Structure'
# spent 15.7ms making 11666 calls to PPI::Token::CORE:match, avg 1µs/call
215 and
216 $_[0]->{content} =~ /(?:\(|\[|\{)/
217}
218
219
# spent 152ms (124+27.8) within PPI::Token::__LEXER__closes which was called 45079 times, avg 3µs/call: # 39289 times (95.0ms+20.6ms) by PPI::Lexer::_lex_statement at line 616 of PPI/Lexer.pm, avg 3µs/call # 5790 times (28.8ms+7.22ms) by PPI::Lexer::_lex_structure at line 1354 of PPI/Lexer.pm, avg 6µs/call
sub __LEXER__closes {
22045079260ms2058627.8ms ref($_[0]) eq 'PPI::Token::Structure'
# spent 27.8ms making 20586 calls to PPI::Token::CORE:match, avg 1µs/call
221 and
222 $_[0]->{content} =~ /(?:\)|\]|\})/
223}
224
22513µs1;
226
227=pod
228
229=head1 SUPPORT
230
231See the L<support section|PPI/SUPPORT> in the main module.
232
233=head1 AUTHOR
234
235Adam Kennedy E<lt>adamk@cpan.orgE<gt>
236
237=head1 COPYRIGHT
238
239Copyright 2001 - 2011 Adam Kennedy.
240
241This program is free software; you can redistribute
242it and/or modify it under the same terms as Perl itself.
243
244The full text of the license can be found in the
245LICENSE file included with this module.
246
247=cut
 
# spent 61.9ms within PPI::Token::CORE:match which was called 49942 times, avg 1µs/call: # 20586 times (27.8ms+0s) by PPI::Token::__LEXER__closes at line 220, avg 1µs/call # 11666 times (15.7ms+0s) by PPI::Token::__LEXER__opens at line 214, avg 1µs/call # 8845 times (10.3ms+0s) by PPI::Token::set_class at line 95, avg 1µs/call # 8845 times (8.01ms+0s) by PPI::Token::set_class at line 96, avg 906ns/call
sub PPI::Token::CORE:match; # opcode