1PPI::Statement::VariablUes(e3r)Contributed Perl DocumentPaPtIi:o:nStatement::Variable(3)
2
3
4
6 PPI::Statement::Variable - Variable declaration statements
7
9 # All of the following are variable declarations
10 my $foo = 1;
11 my ($foo, $bar) = (1, 2);
12 our $foo = 1;
13 local $foo;
14 local $foo = 1;
15 LABEL: my $foo = 1;
16
18 PPI::Statement::Variable
19 isa PPI::Statement::Expression
20 isa PPI::Statement
21 isa PPI::Node
22 isa PPI::Element
23
25 The main intent of the "PPI::Statement::Variable" class is to describe
26 simple statements that explicitly declare new local or global vari‐
27 ables.
28
29 Note that this does not make it exclusively the only place where vari‐
30 ables are defined, and later on you should expect that the "variables"
31 method will migrate deeper down the tree to either PPI::Statement or
32 PPI::Node to recognise this fact, but for now it stays here.
33
35 type
36
37 The "type" method checks and returns the declaration type of the state‐
38 ment, which will be one of either 'my', 'local' or 'our'.
39
40 Returns a string of the type, or "undef" if the type cannot be detected
41 (which is probably a bug).
42
43 variables
44
45 As for several other PDOM Element types that can declare variables, the
46 "variables" method returns a list of the canonical forms of the vari‐
47 ables defined by the statement.
48
49 Returns a list of the canonical string forms of variables, or the null
50 list if it is unable to find any variables.
51
53 - Write unit tests for this
54
56 See the support section in the main module.
57
59 Adam Kennedy <adamk@cpan.org>
60
62 Copyright 2001 - 2006 Adam Kennedy.
63
64 This program is free software; you can redistribute it and/or modify it
65 under the same terms as Perl itself.
66
67 The full text of the license can be found in the LICENSE file included
68 with this module.
69
70
71
72perl v5.8.8 2006-09-23 PPI::Statement::Variable(3)