PPI/Statement/When.pm

filter: Statementstmt 85.7% 12 / 14 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 57.1% 16 / 28 CC 3 SCAR 17.4
CC
3
Cov
60%
_complete
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.7
« PPI/Statement/Given.pm ↑ Summary PPI/Token/_QuoteEngine.pm »
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 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 62 ▶use PPI::Statement ();
Subroutine BEGIN: called CC=1 SCAR=0.0
44  
45 62 ▶use vars qw{$VERSION @ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
46 BEGIN {
47 62 ▶ $VERSION = '1.236';
Subroutine BEGIN: called CC=1 SCAR=0.0
48 62 @ISA = 'PPI::Statement';
49 }
50  
51 # Lexer clues
52 sub __LEXER__normal() { '' }
53  
54 sub _complete {
55 0 ▶ my $child = $_[0]->schild(-1);
Subroutine _complete: not called CC=3 SCAR=24.8
56 return !! (
57 0 ▶ defined $child
Condition0%0/6
defined $child && $child->isa('PPI::Structure::Block') && $child->complete
!ll&&!rl&&r
000
defined $child and $child->isa("PPI::Structure::Block")
!ll&&!rl&&r
000
MC/DC0%0/3
defined $child && $child->isa('PPI::Structure::Block') && $child->complete
defined $child $child->isa("PPI::Structure::Block") $child->complete
Truth table0%0/4
A and B && C
A= defined $childB= $child->isa("PPI::Structure::Block")C= $child->complete
ABCresult
0XX0
10X0
1100
1111
58 and
59 $child->isa('PPI::Structure::Block')
60 and
61 $child->complete
62 );
63 }
64  
65  
66  
67  
68  
69 #####################################################################
70 # PPI::Node Methods
71  
72 sub scope() {
73 1;
74 }
75  
76 62 1;
77  
78 =pod
79  
80 =head1 TO DO
81  
82 - Write unit tests for this package
83  
84 =head1 SUPPORT
85  
86 See the L<support section|PPI/SUPPORT> in the main module.
87  
88 =head1 AUTHOR
89  
90 Adam Kennedy E<lt>adamk@cpan.orgE<gt>
91  
92 =head1 COPYRIGHT
93  
94 Copyright 2001 - 2011 Adam Kennedy.
95  
96 This program is free software; you can redistribute
97 it and/or modify it under the same terms as Perl itself.
98  
99 The full text of the license can be found in the
100 LICENSE file included with this module.
101  
102 =cut
« PPI/Statement/Given.pm ↑ Summary PPI/Token/_QuoteEngine.pm »