File Coverage

blib/lib/PPI/Token/ArrayIndex.pm
Criterion Covered Total %
statement 12 12 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod n/a
total 16 17 94.1


line stmt bran cond sub pod time code
1             package PPI::Token::ArrayIndex;
2              
3             =pod
4              
5             =head1 NAME
6              
7             PPI::Token::ArrayIndex - Token getting the last index for an array
8              
9             =head1 INHERITANCE
10              
11             PPI::Token::ArrayIndex
12             isa PPI::Token
13             isa PPI::Element
14              
15             =head1 DESCRIPTION
16              
17             The C token represents an attempt to get the
18             last index of an array, such as C<$#array>.
19              
20             =head1 METHODS
21              
22             There are no additional methods beyond those provided by the parent
23             L and L classes.
24              
25             =cut
26              
27 64     64   363 use strict;
  64         112  
  64         1460  
28 64     64   269 use PPI::Token ();
  64         121  
  64         11664  
29              
30             our $VERSION = '1.275';
31              
32             our @ISA = "PPI::Token";
33              
34              
35              
36              
37              
38             #####################################################################
39             # Tokenizer Methods
40              
41             sub __TOKENIZER__on_char {
42 99     99   155 my $t = $_[1];
43              
44             # Suck in till the end of the arrayindex
45 99         257 pos $t->{line} = $t->{line_cursor};
46 99 50       424 if ( $t->{line} =~ m/\G([\w:']+)/gc ) {
47 99         534 $t->{token}->{content} .= $1;
48 99         185 $t->{line_cursor} += length $1;
49             }
50              
51             # End of token
52 99         246 $t->_finalize_token->__TOKENIZER__on_char( $t );
53             }
54              
55             1;
56              
57             =pod
58              
59             =head1 SUPPORT
60              
61             See the L in the main module.
62              
63             =head1 AUTHOR
64              
65             Adam Kennedy Eadamk@cpan.orgE
66              
67             =head1 COPYRIGHT
68              
69             Copyright 2001 - 2011 Adam Kennedy.
70              
71             This program is free software; you can redistribute
72             it and/or modify it under the same terms as Perl itself.
73              
74             The full text of the license can be found in the
75             LICENSE file included with this module.
76              
77             =cut