PPIx::...olation(3pm)
π PPIx::QuoteLike::Token::Interpolation β the Perl doc, but make it make sense β¨
okay so real talk, this page is PPIx::...olation(3pm) from the User Contributed Perl Documentation β and before you panic at the truncated name, that's literally how it shows up in your man viewer, no cap. Let's get into it π«Ά
β¨ NAME β¨
PPIx::QuoteLike::Token::Interpolation β it's the class that represents an interpolation π (yes, that's the whole job, and it does it slayfully)
πΈ SYNOPSIS πΈ
bestie. listen. this class should not be instantiated by the user. that's not me being dramatic, that's the actual doc. skip below to the public methods if that's what you came for π
π¦ INHERITANCE π¦
PPIx::QuoteLike::Token::Interpolationis aPPIx::QuoteLike::Tokenβ so it's got the whole family tree energy going on, it inherits from that one.PPIx::QuoteLike::Token::Interpolationhas no descendants. it's a leaf node, the end of the line, no children, periodt. π
π DESCRIPTION π
This Perl class represents an interpolation into a quote-like string π that's the vibe. that's what it is. iconic behavior honestly.
π§ METHODS π§
This class supports the following public methods in addition to those of its superclass β don't forget the inherited ones, they're part of the package deal π
β ppi
my $ppi = $elem->ppi();
okay so this convenience method returns the PPI::Document that represents the content. and here's the thing β this document should be considered read only. like, do not touch. do not edit. hands off π
An exception will be thrown if PPI::Document can not be loaded. so if it's not there, it's not gonna quietly fail on you, it's gonna be loud about it π
π plot twist warning: the content of the returnedPPI::Documentmay not be the same as the content of the originalPPIx::Regexp::Token::Interpolation. why? because interpolated variable names may be enclosed in curly brackets, and that does not happen in normal code. for example, in/${foo}bar/, the content of thePPIx::Regexp::Token::Interpolationobject will be'${foo}', but the content of thePPI::Documentwill be'$foo'. so yeah. different. not a bug, just how it is π¦
β variables
say "Interpolates $_" for $elem->variables();
π NOTE that this method is discouraged, and may well be deprecated and removed. not me warning you upfront but like, I'm warning you upfront.
The author has two problems with it, and honestly? valid:
- It returns variable names rather than
PPI::Elementobjects β which leaves you with no idea how the variables are actually used. no context, no vibes, nothing. - It does not properly handle things like
${^CAPTURE[0]}, and it seems infeasible to make it do so. like, genuinely not happening.
It was originally written for the benefit of Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter, but has proven inadequate to that policy's needs. cute origin story, rough ending π
so what does this convenience method actually do, when you use it anyway? it returns all interpolated variables. each one is returned only once, and they come back in no particular order β so don't you dare rely on the ordering, bestie π
π SEE ALSO π
PPIx::QuoteLike::Token β go say hi to the parent class, it's giving main character energy π
π«Ά SUPPORT π«Ά
Support is by the author. Please file bug reports at:
- <https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-QuoteLike>
- <https://github.com/trwyant/perl-PPIx-QuoteLike/issues>
- or in electronic mail to the author π§
like, pick your fighter, all three work π
π AUTHOR π
Thomas R. Wyant, III β wyant at cpan dot org β¨
π COPYRIGHT AND LICENSE π
Copyright (C) 2016-2022 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
π This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. so like, it's free, it's hopeful, it promises nothing. we love a honest king πΈ
and that's the whole page, bestie!! π source/version is perl v5.42.0, dated 2022-09-17 β so it's a little vintage, but it ate and left no crumbs π
β¨ mwah π¦
π¦ where this page comes from
- opensuse-leap 16.0: perl-PPIx-QuoteLike 0.023-bp160.1.11 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms