1PPI::Statement::VariablUes(e3r)Contributed Perl DocumentPaPtIi:o:nStatement::Variable(3)
2
3
4

NAME

6       PPI::Statement::Variable - Variable declaration statements
7

SYNOPSIS

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

INHERITANCE

18         PPI::Statement::Variable
19         isa PPI::Statement::Expression
20             isa PPI::Statement
21                 isa PPI::Node
22                     isa PPI::Element
23

DESCRIPTION

25       The main intent of the "PPI::Statement::Variable" class is to describe
26       simple statements that explicitly declare new local or global
27       variables.
28
29       Note that this does not make it exclusively the only place where
30       variables are defined, and later on you should expect that the
31       "variables" method will migrate deeper down the tree to either
32       PPI::Statement or PPI::Node to recognise this fact, but for now it
33       stays here.
34

METHODS

36   type
37       The "type" method checks and returns the declaration type of the
38       statement, which will be one of 'my', 'local', 'our', or 'state'.
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       As for several other PDOM Element types that can declare variables, the
45       "variables" method returns a list of the canonical forms of the
46       variables defined by the statement.
47
48       Returns a list of the canonical string forms of variables, or the null
49       list if it is unable to find any variables.
50
51   symbols
52       Returns a list of the variables defined by the statement, as
53       PPI::Token::Symbols.
54

TO DO

56       - Write unit tests for this
57

SUPPORT

59       See the support section in the main module.
60

AUTHOR

62       Adam Kennedy <adamk@cpan.org>
63
65       Copyright 2001 - 2011 Adam Kennedy.
66
67       This program is free software; you can redistribute it and/or modify it
68       under the same terms as Perl itself.
69
70       The full text of the license can be found in the LICENSE file included
71       with this module.
72
73
74
75perl v5.32.0                      2020-07-28       PPI::Statement::Variable(3)
Impressum