1PPI::Statement::CompounUds(e3r)Contributed Perl DocumentPaPtIi:o:nStatement::Compound(3)
2
3
4
6 PPI::Statement::Compound - Describes all compound statements
7
9 # A compound if statement
10 if ( foo ) {
11 bar();
12 } else {
13 baz();
14 }
15
16 # A compound loop statement
17 foreach ( @list ) {
18 bar($_);
19 }
20
22 PPI::Statement::Compound
23 isa PPI::Statement
24 isa PPI::Node
25 isa PPI::Element
26
28 "PPI::Statement::Compound" objects are used to describe all current
29 forms of compound statements, as described in perlsyn.
30
31 This covers blocks using "if", "unless", "for", "foreach", "while", and
32 "continue". Please note this does not cover "simple" statements with
33 trailing conditions. Please note also that "do" is also not part of a
34 compound statement.
35
36 # This is NOT a compound statement
37 my $foo = 1 if $condition;
38
39 # This is also not a compound statement
40 do { ... } until $condition;
41
43 "PPI::Statement::Compound" has a number of methods in addition to the
44 standard PPI::Statement, PPI::Node and PPI::Element methods.
45
46 type
47
48 The "type" method returns the fundamental type of the compound stateā
49 ment.
50
51 There are three basic compound statement types.
52
53 The 'if' type includes all variations of the if and unless statements,
54 including any 'elsif' or 'else' parts of the compound statement.
55
56 The 'while' type describes the standard while statement, but again does
57 not describes simple statements with a trailing while.
58
59 The 'for' type covers both of 'for' and 'foreach' statements.
60
61 All of the compounds are a variation on one of these three.
62
63 Returns the simple string 'if', 'for' or 'while', or "undef" if the
64 type cannot be determined.
65
67 - Write unit tests for this package
68
70 See the support section in the main module.
71
73 Adam Kennedy <adamk@cpan.org>
74
76 Copyright 2001 - 2006 Adam Kennedy.
77
78 This program is free software; you can redistribute it and/or modify it
79 under the same terms as Perl itself.
80
81 The full text of the license can be found in the LICENSE file included
82 with this module.
83
84
85
86perl v5.8.8 2006-09-23 PPI::Statement::Compound(3)