1PPIx::EditorTools::RenaUmseeVrarCioanbtlrei(b3u)ted PerlPPDIoxc:u:mEednittaotriToonols::RenameVariable(3)
2
3
4

NAME

6       PPIx::EditorTools::RenameVariable - Lexically replace a variable name
7       in Perl code
8

SYNOPSIS

10           my $munged = PPIx::EditorTools::RenameVariable->new->rename(
11               code        => $code,
12               line        => 15,
13               column      => 13,
14               replacement => 'stuff',
15           );
16           my $code_as_strig = $munged->code;
17           my $code_as_ppi   = $munged->ppi;
18           my $location      = $munged->element->location;
19

DESCRIPTION

21       This module will lexically replace a variable name.
22

METHODS

24       new()
25           Constructor. Generally shouldn't be called with any arguments.
26
27       rename( ppi => PPI::Document $ppi, line => Int, column => Int,
28       replacement => Str ) =item rename( code => Str $code, line => Int,
29       column => Int, replacement => Str )
30           Accepts either a "PPI::Document" to process or a string containing
31           the code (which will be converted into a "PPI::Document") to
32           process.  Renames the variable found at line, column with that
33           supplied in the "replacement" parameter and returns a
34           "PPIx::EditorTools::ReturnObject" with the new code available via
35           the "ppi" or "code" accessors, as a "PPI::Document" or "string",
36           respectively. The "PPI::Token" found at line, column is available
37           via the "element" accessor.
38
39           Croaks with a "no token" exception if no token is found at the
40           location.  Croaks with a "no declaration" exception if unable to
41           find the declaration.
42

SEE ALSO

44       This class inherits from "PPIx::EditorTools".  Also see
45       App::EditorTools, Padre, and PPI.
46

AUTHOR

48       Mark Grimes, <mgrimes@cpan.org>
49
51       Copyright (C) 2009 by Mark Grimes
52
53       This library is free software; you can redistribute it and/or modify it
54       under the same terms as Perl itself, either Perl version 5.8.2 or, at
55       your option, any later version of Perl 5 you may have available.
56
57
58
59perl v5.12.0                      2009-09-1P9PIx::EditorTools::RenameVariable(3)
Impressum