1PPIx::Utilities::StatemUesnetr(3C)ontributed Perl DocumePnPtIaxt:i:oUntilities::Statement(3)
2
3
4
6 PPIx::Utilities::Statement - Extensions to PPI::Statement.
7
9 This document describes PPIx::Utilities::Statement version 1.0.1.
10
12 use PPI::Document qw< >;
13
14 use PPIx::Utilities::Statement qw<
15 get_constant_name_elements_from_declaring_statement
16 >;
17
18 my $document = PPI::Document->new(\'Readonly::Scalar my $THINGY => 47.2;');
19
20 # Returns the PPI::Token::Symbol for "$THINGY".
21 my ($constant) = get_constant_name_elements_from_declaring_statement(
22 $document->schild(0)
23 );
24
26 This is a collection of functions for dealing with PPI::Statements.
27
29 Nothing is exported by default.
30
31 "get_constant_name_elements_from_declaring_statement($statement)"
32 Given a PPI::Statement, if the statement is a "use constant" or
33 Readonly declaration statement, returns the names of the things being
34 defined. If called in scalar context, return the number of names
35 defined.
36
37 Given
38
39 use constant 1.16 FOO => 'bar';
40
41 this will return the PPI::Token::Word containing 'FOO'. Given
42
43 use constant 1.16 { FOO => 'bar', 'BAZ' => 'burfle' };
44
45 this will return a list of the PPI::Tokens containing 'FOO' and 'BAZ'.
46 Similarly, given
47
48 Readonly::Hash my %FOO => ( bar => 'baz' );
49
50 this will return the PPI::Token::Symbol containing '%FOO'.
51
53 Please report any bugs or feature requests to
54 "bug-ppix-utilities@rt.cpan.org", or through the web interface at
55 <http://rt.cpan.org>.
56
58 Thomas R. Wyant, III "<wyant at cpan dot org>"
59
61 Copyright (c) 2009-2010 Thomas R. Wyant, III. All rights reserved.
62
63 This program is free software; you can redistribute it and/or modify it
64 under the same terms as Perl itself. The full text of this license can
65 be found in the LICENSE file included with this module.
66
67
68
69perl v5.12.1 2010-03-14 PPIx::Utilities::Statement(3)