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.1.0.
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 Readonly or Const::Fast
33 declaration statement or a "use constant", returns the names of the
34 things being defined.
35
36 Given
37
38 use constant 1.16 FOO => 'bar';
39
40 this will return the PPI::Token::Word containing 'FOO'. Given
41
42 use constant 1.16 { FOO => 'bar', 'BAZ' => 'burfle' };
43
44 this will return a list of the PPI::Tokens containing 'FOO' and 'BAZ'.
45 Similarly, given
46
47 Readonly::Hash my %FOO => ( bar => 'baz' );
48
49 or
50
51 const my %FOO => ( bar => 'baz' );
52
53 this will return the PPI::Token::Symbol containing '%FOO'.
54
56 Please report any bugs or feature requests to
57 "bug-ppix-utilities@rt.cpan.org", or through the web interface at
58 <http://rt.cpan.org>.
59
61 Thomas R. Wyant, III "<wyant at cpan dot org>"
62
64 Copyright (c) 2009-2010 Thomas R. Wyant, III. All rights reserved.
65
66 This program is free software; you can redistribute it and/or modify it
67 under the same terms as Perl itself. The full text of this license can
68 be found in the LICENSE file included with this module.
69
70
71
72perl v5.32.1 2021-01-27 PPIx::Utilities::Statement(3)