PPIx::...ration(3pm)
π PPIx::EditorTools::FindVariableDeclaration β wait, bestie, the page title is PPIx::...ration(3pm) πΈ
okay so real talk: this is PPIx::EditorTools::FindVariableDeclaration β it's part of the User Contributed Perl Documentation crowd, and it does exactly one thing but it does it iconically: it finds where a variable was declared, using PPI. π¦
β¨ VERSION β¨
version 0.21 π
π SYNOPSIS π
# finds declaration of variable at cursor
my $declaration = PPIx::EditorTools::FindVariableDeclaration->new->find(
code =>
"package TestPackage;\nuse strict;\nBEGIN {
\$^W = 1;
}\nmy \$x=1;\n\$x++;"
line => 5,
column => 2,
);
my $location = $declaration->element->location;
like. look at her go. π«Ά
π DESCRIPTION π
Finds the location of a variable declaration. that's it, that's the whole vibe. no cap. β¨
π METHODS π
new()
Constructor. and like, the vibes say: generally shouldn't be called with any arguments. so don't be messy about it bestie π
find( ppi => PPI::Document $ppi, line => $line, column => $column )
find( code => Str $code, line => $line, column => $column )
okay so she's flexible, she takes either:
- a
PPI::Documentto process, OR - a string containing the code β which gets converted into a
PPI::Documentfor you, no extra work, we love a helpful queen π
then she searches for the variable declaration and returns a PPIx::EditorTools::ReturnObject with the declaration (PPI::Statement::Variable) available via the element accessor. π¦
β οΈ she croaks with a"no token"exception if no token is found at the location. and she croaks with a"no declaration"exception if she's unable to find the declaration. so yeah, she will absolutely tell you when something's off, she's not shy π
π SEE ALSO π
This class inherits from PPIx::EditorTools. π
Also go look at App::EditorTools, Padre, and PPI. iykyk. πΈ
β 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>
the whole squad, honestly. π
π 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. periodt. π
mwah π this was PPIx::...ration(3pm) from perl v5.34.0, dated 2022-06-17, living under User Contributed Perl Documentation. stay slaying bestie π«Άβ¨
π¦ 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