File Coverage

blib/lib/PPI/Structure/List.pm
Criterion Covered Total %
statement 11 17 64.7
branch 1 6 16.6
condition 1 6 16.6
subroutine 4 4 100.0
pod 0 1 0.0
total 17 34 50.0


line stmt bran cond sub pod time code
1             package PPI::Structure::List;
2              
3             =pod
4              
5             =head1 NAME
6              
7             PPI::Structure::List - Explicit list or precedence ordering braces
8              
9             =head1 SYNOPSIS
10              
11             # A list used for params
12             function( 'param', 'param' );
13            
14             # Explicit list
15             return ( 'foo', 'bar' );
16              
17             =head1 INHERITANCE
18              
19             PPI::Structure::List
20             isa PPI::Structure
21             isa PPI::Node
22             isa PPI::Element
23              
24             =head1 DESCRIPTION
25              
26             C<PPI::Structure::List> is the class used for circular braces that
27             represent lists, and related.
28              
29             =head1 METHODS
30              
31             C<PPI::Structure::List> has no methods beyond those provided by the
32             standard L<PPI::Structure>, L<PPI::Node> and L<PPI::Element> methods.
33              
34             =cut
35              
36 66     66   332 use strict;
  66         100  
  66         1816  
37 66     66   627 use Carp ();
  66         104  
  66         977  
38 66     66   206 use PPI::Structure ();
  66         93  
  66         12771  
39              
40             our $VERSION = '1.284';
41              
42             our @ISA = "PPI::Structure";
43              
44             # Highly special custom isa method that will continue to respond
45             # positively to ->isa('PPI::Structure::ForLoop') but warns.
46             my $has_warned = 0;
47             sub isa {
48 93772 50 33 93772 0 231837 if ( $_[1] and $_[1] eq 'PPI::Structure::ForLoop' ) {
49 0 0 0     0 if (
50             $_[0]->parent->isa('PPI::Statement::Compound')
51             and
52             $_[0]->parent->type =~ /^for/
53             ) {
54 0 0       0 unless ( $has_warned ) {
55 0         0 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
56 0         0 Carp::carp("PPI::Structure::ForLoop has been deprecated");
57 0         0 $has_warned = 1;
58             }
59 0         0 return 1;
60             }
61             }
62 93772         446038 return shift->SUPER::isa(@_);
63             }
64              
65             1;
66              
67             =pod
68              
69             =head1 SUPPORT
70              
71             See the L<support section|PPI/SUPPORT> in the main module.
72              
73             =head1 AUTHOR
74              
75             Adam Kennedy E<lt>adamk@cpan.orgE<gt>
76              
77             =head1 COPYRIGHT
78              
79             Copyright 2001 - 2011 Adam Kennedy.
80              
81             This program is free software; you can redistribute
82             it and/or modify it under the same terms as Perl itself.
83              
84             The full text of the license can be found in the
85             LICENSE file included with this module.
86              
87             =cut