← 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/QuoteLike/Words.pm
StatementsExecuted 11 statements in 176µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11112µs12µsPPI::Token::QuoteLike::Words::::BEGIN@33PPI::Token::QuoteLike::Words::BEGIN@33
11111µs22µsPPI::Token::QuoteLike::Words::::BEGIN@28PPI::Token::QuoteLike::Words::BEGIN@28
1116µs33µsPPI::Token::QuoteLike::Words::::BEGIN@32PPI::Token::QuoteLike::Words::BEGIN@32
1113µs3µsPPI::Token::QuoteLike::Words::::BEGIN@29PPI::Token::QuoteLike::Words::BEGIN@29
1113µs3µsPPI::Token::QuoteLike::Words::::BEGIN@30PPI::Token::QuoteLike::Words::BEGIN@30
0000s0sPPI::Token::QuoteLike::Words::::literalPPI::Token::QuoteLike::Words::literal
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::QuoteLike::Words;
2
3=pod
4
5=head1 NAME
6
7PPI::Token::QuoteLike::Words - Word list constructor quote-like operator
8
9=head1 INHERITANCE
10
11 PPI::Token::QuoteLike::Words
12 isa PPI::Token::QuoteLike
13 isa PPI::Token
14 isa PPI::Element
15
16=head1 DESCRIPTION
17
18A C<PPI::Token::QuoteLike::Words> object represents a quote-like operator
19that acts as a constructor for a list of words.
20
21 # Create a list for a significant chunk of the alphabet
22 my @list = qw{a b c d e f g h i j k l};
23
24=head1 METHODS
25
26=cut
27
28218µs234µs
# spent 22µs (11+11) within PPI::Token::QuoteLike::Words::BEGIN@28 which was called: # once (11µs+11µs) by PPI::Token::BEGIN@61 at line 28
use strict;
# spent 22µs making 1 call to PPI::Token::QuoteLike::Words::BEGIN@28 # spent 11µs making 1 call to strict::import
29219µs13µs
# spent 3µs within PPI::Token::QuoteLike::Words::BEGIN@29 which was called: # once (3µs+0s) by PPI::Token::BEGIN@61 at line 29
use PPI::Token::QuoteLike ();
# spent 3µs making 1 call to PPI::Token::QuoteLike::Words::BEGIN@29
30217µs13µs
# spent 3µs within PPI::Token::QuoteLike::Words::BEGIN@30 which was called: # once (3µs+0s) by PPI::Token::BEGIN@61 at line 30
use PPI::Token::_QuoteEngine::Full ();
# spent 3µs making 1 call to PPI::Token::QuoteLike::Words::BEGIN@30
31
32232µs261µs
# spent 33µs (6+27) within PPI::Token::QuoteLike::Words::BEGIN@32 which was called: # once (6µs+27µs) by PPI::Token::BEGIN@61 at line 32
use vars qw{$VERSION @ISA};
# spent 33µs making 1 call to PPI::Token::QuoteLike::Words::BEGIN@32 # spent 27µs making 1 call to vars::import
33
# spent 12µs within PPI::Token::QuoteLike::Words::BEGIN@33 which was called: # once (12µs+0s) by PPI::Token::BEGIN@61 at line 39
BEGIN {
341300ns $VERSION = '1.215';
35113µs @ISA = qw{
36 PPI::Token::_QuoteEngine::Full
37 PPI::Token::QuoteLike
38 };
39176µs112µs}
# spent 12µs making 1 call to PPI::Token::QuoteLike::Words::BEGIN@33
40
41=pod
42
43=head2 literal
44
45Returns the words contained. Note that this method does not check the
46context that the token is in; it always returns the list and not merely
47the last element if the token is in scalar context.
48
49=begin testing literal 12
50
51my $empty_list_document = PPI::Document->new(\<<'END_PERL');
52qw//
53qw/ /
54END_PERL
55
56isa_ok( $empty_list_document, 'PPI::Document' );
57my $empty_list_tokens =
58 $empty_list_document->find('PPI::Token::QuoteLike::Words');
59is( scalar @{$empty_list_tokens}, 2, 'Found expected empty word lists.' );
60foreach my $token ( @{$empty_list_tokens} ) {
61 my @literal = $token->literal;
62 is( scalar @literal, 0, qq<No elements for "$token"> );
63}
64
65my $non_empty_list_document = PPI::Document->new(\<<'END_PERL');
66qw/foo bar baz/
67qw/ foo bar baz /
68qw {foo bar baz}
69END_PERL
70my @expected = qw/ foo bar baz /;
71
72isa_ok( $non_empty_list_document, 'PPI::Document' );
73my $non_empty_list_tokens =
74 $non_empty_list_document->find('PPI::Token::QuoteLike::Words');
75is(
76 scalar(@$non_empty_list_tokens),
77 3,
78 'Found expected non-empty word lists.',
79);
80foreach my $token ( @$non_empty_list_tokens ) {
81 my $literal = $token->literal;
82 is(
83 $literal,
84 scalar @expected,
85 qq<Scalar context literal() returns the list for "$token">,
86 );
87 my @literal = $token->literal;
88 is_deeply( [ $token->literal ], \@expected, '->literal matches expected' );
89}
90
91=end testing
92
93=cut
94
95sub literal {
96 my $self = shift;
97 my $section = $self->{sections}->[0];
98 return split ' ', substr(
99 $self->{content},
100 $section->{position},
101 $section->{size},
102 );
103}
104
10512µs1;
106
107=pod
108
109=head1 SUPPORT
110
111See the L<support section|PPI/SUPPORT> in the main module.
112
113=head1 AUTHOR
114
115Adam Kennedy E<lt>adamk@cpan.orgE<gt>
116
117=head1 COPYRIGHT
118
119Copyright 2001 - 2011 Adam Kennedy.
120
121This program is free software; you can redistribute
122it and/or modify it under the same terms as Perl itself.
123
124The full text of the license can be found in the
125LICENSE file included with this module.
126
127=cut