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 is the class used for circular braces that
27             represent lists, and related.
28              
29             =head1 METHODS
30              
31             C has no methods beyond those provided by the
32             standard L, L and L methods.
33              
34             =cut
35              
36 64     64   454 use strict;
  64         128  
  64         1788  
37 64     64   330 use Carp ();
  64         170  
  64         763  
38 64     64   353 use PPI::Structure ();
  64         143  
  64         14089  
39              
40             our $VERSION = '1.277';
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 90468 50 33 90468 0 280809 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 90468         545616 return shift->SUPER::isa(@_);
63             }
64              
65             1;
66              
67             =pod
68              
69             =head1 SUPPORT
70              
71             See the L in the main module.
72              
73             =head1 AUTHOR
74              
75             Adam Kennedy Eadamk@cpan.orgE
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