File Coverage

blib/lib/PPI/Statement/When.pm
Criterion Covered Total %
statement 6 8 75.0
branch n/a
condition 0 3 0.0
subroutine 2 3 66.6
pod n/a
total 8 14 57.1


line stmt bran cond sub pod time code
1             package PPI::Statement::When;
2              
3             =pod
4              
5             =head1 NAME
6              
7             PPI::Statement::When - A when statement
8              
9             =head1 SYNOPSIS
10              
11             foreach ( qw/ foo bar baz / ) {
12             when ( m/b/ ) {
13             boing($_);
14             }
15             when ( m/f/ ) {
16             boom($_);
17             }
18             default {
19             tchak($_);
20             }
21             }
22              
23             =head1 INHERITANCE
24              
25             PPI::Statement::When
26             isa PPI::Statement
27             isa PPI::Node
28             isa PPI::Element
29              
30             =head1 DESCRIPTION
31              
32             C<PPI::Statement::When> objects are used to describe when and default
33             statements, as described in L<perlsyn>.
34              
35             =head1 METHODS
36              
37             C<PPI::Structure::When> has no methods beyond those provided by the
38             standard L<PPI::Structure>, L<PPI::Node> and L<PPI::Element> methods.
39              
40             =cut
41              
42 66     66   354 use strict;
  66         109  
  66         1794  
43 66     66   276 use PPI::Statement ();
  66         122  
  66         8933  
44              
45             our $VERSION = '1.284';
46              
47             our @ISA = "PPI::Statement";
48              
49             # Lexer clues
50             sub __LEXER__normal() { '' }
51              
52             sub _complete {
53 0     0     my $child = $_[0]->schild(-1);
54             return !! (
55 0   0       defined $child
56             and
57             $child->isa('PPI::Structure::Block')
58             and
59             $child->complete
60             );
61             }
62              
63              
64              
65              
66              
67             #####################################################################
68             # PPI::Node Methods
69              
70             sub scope() {
71             1;
72             }
73              
74             1;
75              
76             =pod
77              
78             =head1 TO DO
79              
80             - Write unit tests for this package
81              
82             =head1 SUPPORT
83              
84             See the L<support section|PPI/SUPPORT> in the main module.
85              
86             =head1 AUTHOR
87              
88             Adam Kennedy E<lt>adamk@cpan.orgE<gt>
89              
90             =head1 COPYRIGHT
91              
92             Copyright 2001 - 2011 Adam Kennedy.
93              
94             This program is free software; you can redistribute
95             it and/or modify it under the same terms as Perl itself.
96              
97             The full text of the license can be found in the
98             LICENSE file included with this module.
99              
100             =cut