Simple object to return values from ppix::editortools
my $brace = PPIx::EditorTools::FindUnmatchedBrace->new->find( code => "package TestPackage;\nsub x { 1;\n" ); my $location = $brace->element->location; my $ppi = $brace->element->ppi;
Retuning a simple \*(C`PPI::Element\*(C' from many of the \*(C`PPIx::EditorTools\*(C' methods often results in the loss of the overall context for that element. \*(C`PPIx::EditorTools::ReturnObject\*(C' provides an object that can be passed around which retains the overall context.
For example, in \*(C`PPIx::EditorTools::FindUnmatchedBrace\*(C' if the unmatched brace were returned by its \*(C`PPI::Structure::Block\*(C' the containing \*(C`PPI::Document\*(C' is likely to go out of scope, thus the \*(C`location\*(C' method no longer returns a valid location (rather it returns undef). Using the \*(C`ReturnObject\*(C' preserves the \*(C`PPI::Document\*(C' and the containing context.
Constructor which should be used by \*(C`PPIx::EditorTools\*(C'. Accepts the following named parameters:
A \*(C`PPI::Document\*(C' representing the (possibly modified) code.
A string representing the (possibly modified) code.
A \*(C`PPI::Element\*(C' or a subclass thereof representing the interesting element.
Accessor to retrieve the \*(C`PPI::Document\*(C'. May create the \*(C`PPI::Document\*(C' from the $code string (lazily) if needed.
Accessor to retrieve the string representation of the code. May be retrieved from the \*(C`PPI::Document\*(C' via the serialize method (lazily) if needed.
\*(C`PPIx::EditorTools\*(C', App::EditorTools, Padre, and \s-1PPI\s0.