| 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 objects are used to describe when and default |
|
33
|
|
|
|
|
|
|
statements, as described in L. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
C has no methods beyond those provided by the |
|
38
|
|
|
|
|
|
|
standard L, L and L methods. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
63
|
|
|
63
|
|
442
|
use strict; |
|
|
63
|
|
|
|
|
116
|
|
|
|
63
|
|
|
|
|
1405
|
|
|
43
|
63
|
|
|
63
|
|
267
|
use PPI::Statement (); |
|
|
63
|
|
|
|
|
96
|
|
|
|
63
|
|
|
|
|
7285
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
our $VERSION = '1.275'; |
|
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 in the main module. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
|
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 |