1PPIx::QuoteLike::Token:U:sIenrteCropnotlraitbiuotne(d3P)PPeIrxl::DQoucoutmeeLnitkaet:i:oTnoken::Interpolation(3)
2
3
4
6 PPIx::QuoteLike::Token::Interpolation - Represent an interpolation
7
9 This class should not be instantiated by the user. See below for public
10 methods.
11
13 "PPIx::QuoteLike::Token::Interpolation" is a PPIx::QuoteLike::Token.
14
15 "PPIx::QuoteLike::Token::Interpolation" has no descendants.
16
18 This Perl class represents an interpolation into a quote-like string.
19
21 This class supports the following public methods in addition to those
22 of its superclass:
23
24 ppi
25 my $ppi = $elem->ppi();
26
27 This convenience method returns the PPI::Document representing the
28 content. This document should be considered read only. An exception
29 will be thrown if PPI::Document can not be loaded.
30
31 Note that the content of the returned PPI::Document may not be the same
32 as the content of the original "PPIx::Regexp::Token::Interpolation".
33 This can happen because interpolated variable names may be enclosed in
34 curly brackets, but this does not happen in normal code. For example,
35 in "/${foo}bar/", the content of the
36 "PPIx::Regexp::Token::Interpolation" object will be '${foo}', but the
37 content of the "PPI::Document" will be '$foo'.
38
39 variables
40 say "Interpolates $_" for $elem->variables();
41
42 NOTE that this method is discouraged, and may well be deprecated and
43 removed. I have two problems with it. The first is that it returns
44 variable names rather than PPI::Element objects, leaving you no idea
45 how the variables are used. The second is that it does not properly
46 handle things like "${^CAPTURE[0]}", and it seems infeasible to make it
47 do so. It was originally written for the benefit of
48 Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter, but has
49 proven inadequate to that policy's needs.
50
51 This convenience method returns all interpolated variables. Each is
52 returned only once, and they are returned in no particular order.
53
55 PPIx::QuoteLike::Token.
56
58 Support is by the author. Please file bug reports at
59 <https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-QuoteLike>,
60 <https://github.com/trwyant/perl-PPIx-QuoteLike/issues>, or in
61 electronic mail to the author.
62
64 Thomas R. Wyant, III wyant at cpan dot org
65
67 Copyright (C) 2016-2022 by Thomas R. Wyant, III
68
69 This program is free software; you can redistribute it and/or modify it
70 under the same terms as Perl 5.10.0. For more details, see the full
71 text of the licenses in the directory LICENSES.
72
73 This program is distributed in the hope that it will be useful, but
74 without any warranty; without even the implied warranty of
75 merchantability or fitness for a particular purpose.
76
77
78
79perl v5.38.0 2023-P0P7I-x2:1:QuoteLike::Token::Interpolation(3)