table of contents
PPIx::EditorTools::ReturnObject(3pm) | User Contributed Perl Documentation | PPIx::EditorTools::ReturnObject(3pm) |
NAME¶
PPIx::EditorTools::ReturnObject - Simple object to return values from PPIx::EditorTools
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;
DESCRIPTION¶
Retuning a simple "PPI::Element" from many of the "PPIx::EditorTools" methods often results in the loss of the overall context for that element. "PPIx::EditorTools::ReturnObject" provides an object that can be passed around which retains the overall context.
For example, in "PPIx::EditorTools::FindUnmatchedBrace" if the unmatched brace were returned by its "PPI::Structure::Block" the containing "PPI::Document" is likely to go out of scope, thus the "location" method no longer returns a valid location (rather it returns undef). Using the "ReturnObject" preserves the "PPI::Document" and the containing context.
METHODS¶
- new()
- Constructor which should be used by "PPIx::EditorTools". Accepts the following named parameters:
SEE ALSO¶
"PPIx::EditorTools", App::EditorTools, Padre, and PPI.
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>
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.
2022-06-17 | perl v5.34.0 |