PPIx::...nObject(3pm)
π PPIx::EditorTools::ReturnObject π
okay so bestie, this page lives in the User Contributed Perl Documentation corner of the manual-verse, and honestly? it's a tiny little diva of a module. her whole job is: carry stuff around so nothing gets lost. iconic behaviour, no notes. π
β¨ NAME β¨
PPIx::EditorTools::ReturnObject β a simple object that returns values from PPIx::EditorTools, and like... keeps them safe. π
πΈ VERSION πΈ
version 0.21
π¦ SYNOPSIS π¦
my $brace = PPIx::EditorTools::FindUnmatchedBrace->new->find(
code => "package TestPackage;\nsub x { 1;\n"
);
my $location = $brace->element->location;
my $ppi = $brace->element->ppi;
see how we're grabbing element, then location, then ppi off it? yeah. that's the whole vibe. it's giving β¨ context preservation β¨
π DESCRIPTION π
so here's the tea, bestie. when lots of the PPIx::EditorTools methods just hand you back a plain old PPI::Element, you lose the whole overall context for that element. tragic. genuinely tragic. π
PPIx::EditorTools::ReturnObject is the fix: it gives you an object you can pass around that retains the overall context. main character energy for a wrapper class, honestly.
for example β and this is the part you need to remember β in PPIx::EditorTools::FindUnmatchedBrace, if the unmatched brace got returned by its PPI::Structure::Block, the containing PPI::Document is likely to go out of scope, and then the location method stops returning a valid location. instead? it returns undef. yeah. π
using the ReturnObject preserves the PPI::Document and the containing context. periodt. π
π METHODS π
new()
the constructor, and it's meant to be used by PPIx::EditorTools. it accepts these named parameters:
ppiβ aPPI::Documentrepresenting the (possibly modified) code. π«Άcodeβ a string representing the (possibly modified) code. β¨elementβ aPPI::Elementor a subclass thereof representing the interesting element. π
ppi
accessor to retrieve the PPI::Document. it may create the PPI::Document from the $code string (lazily) if needed. so chill. so lazy. we respect it. π
code
accessor to retrieve the string representation of the code. it may be retrieved from the PPI::Document via the serialize method (lazily) if needed. same energy. same slay. π
π SEE ALSO π
PPIx::EditorTools, App::EditorTools, Padre, and PPI. the whole friend group fr fr. π«
π AUTHORS π
- Steffen Mueller
smueller@cpan.org - Mark Grimes
mgrimes@cpan.org - Ahmad M. Zawawi <ahmad.zawawi@gmail.com>
- Gabor Szabo <gabor@szabgab.com>
- Yanick Champoux <yanick@cpan.org>
look at this lineup. absolute legends, every single one. π
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2017, 2014, 2012 by The Padre development team as listed in Padre.pm..
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
bestie the license is literally "same as Perl 5 itself" β go forth, remix, redistribute, it's free. π¦
and that's the whole page!! this was perl v5.34.0, dated 2022-06-17, delivered to you from the PPIx::...nObject(3pm) manual page (the title got a lil truncated in the header, she's shy). anyway mwah, go preserve some context, love u πβ¨π
π¦ where this page comes from
- debian bookworm: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms