1PPIx::EditorTools::RetuUrsneOrbjCeocntt(r3i)buted Perl DPoPcIuxm:e:nEtdaittioornTools::ReturnObject(3)
2
3
4

NAME

6       PPIx::EditorTools::ReturnObject - Simple object to return values from
7       PPIx::EditorTools
8

VERSION

10       version 0.21
11

SYNOPSIS

13         my $brace = PPIx::EditorTools::FindUnmatchedBrace->new->find(
14               code => "package TestPackage;\nsub x { 1;\n"
15             );
16         my $location = $brace->element->location;
17         my $ppi      = $brace->element->ppi;
18

DESCRIPTION

20       Retuning a simple "PPI::Element" from many of the "PPIx::EditorTools"
21       methods often results in the loss of the overall context for that
22       element.  "PPIx::EditorTools::ReturnObject" provides an object that can
23       be passed around which retains the overall context.
24
25       For example, in "PPIx::EditorTools::FindUnmatchedBrace" if the
26       unmatched brace were returned by its "PPI::Structure::Block" the
27       containing "PPI::Document" is likely to go out of scope, thus the
28       "location" method no longer returns a valid location (rather it returns
29       undef).  Using the "ReturnObject" preserves the "PPI::Document" and the
30       containing context.
31

METHODS

33       new()
34           Constructor which should be used by "PPIx::EditorTools". Accepts
35           the following named parameters:
36
37           ppi A "PPI::Document" representing the (possibly modified) code.
38
39           code
40               A string representing the (possibly modified) code.
41
42           element
43               A "PPI::Element" or a subclass thereof representing the
44               interesting element.
45
46       ppi Accessor to retrieve the "PPI::Document". May create the
47           "PPI::Document" from the $code string (lazily) if needed.
48
49       code
50           Accessor to retrieve the string representation of the code. May be
51           retrieved from the "PPI::Document" via the serialize method
52           (lazily) if needed.
53

SEE ALSO

55       "PPIx::EditorTools", App::EditorTools, Padre, and PPI.
56

AUTHORS

58       ·   Steffen Mueller "smueller@cpan.org"
59
60       ·   Mark Grimes "mgrimes@cpan.org"
61
62       ·   Ahmad M. Zawawi <ahmad.zawawi@gmail.com>
63
64       ·   Gabor Szabo  <gabor@szabgab.com>
65
66       ·   Yanick Champoux <yanick@cpan.org>
67
69       This software is copyright (c) 2017, 2014, 2012 by The Padre
70       development team as listed in Padre.pm..
71
72       This is free software; you can redistribute it and/or modify it under
73       the same terms as the Perl 5 programming language system itself.
74
75
76
77perl v5.32.0                      2020-07-28PPIx::EditorTools::ReturnObject(3)
Impressum