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 67     67   467 use strict;
  67         138  
  67         2540  
28 67     67   339 use PPI::Token ();
  67         131  
  67         25861  
29              
30             our $VERSION = '1.28401'; # TRIAL
31              
32             our @ISA = "PPI::Token";
33              
34              
35              
36              
37              
38             #####################################################################
39             # Tokenizer Methods
40              
41             sub __TOKENIZER__on_char {
42 97     97   203 my $t = $_[1];
43              
44             # Suck in till the end of the arrayindex
45 97         569 pos $t->{line} = $t->{line_cursor};
46 97 50       721 if ( $t->{line} =~ m/\G([\w:']+)/gc ) {
47 97         743 $t->{token}->{content} .= $1;
48 97         364 $t->{line_cursor} += length $1;
49             }
50              
51             # End of token
52 97         411 $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