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

VERSION

10       version 0.21
11

SYNOPSIS

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

DESCRIPTION

24       This module will lexically replace a variable name.
25

METHODS

27       new()
28           Constructor. Generally shouldn't be called with any arguments.
29
30       rename( ppi => PPI::Document $ppi, line => Int, column => Int,
31       replacement => Str )
32       rename( code => Str $code, line => Int, column => Int, replacement =>
33       Str )
34       rename( code => Str $code, line => Int, column => Int, to_camel_case =>
35       Bool, [ucfirst => Bool] )
36       rename( code => Str $code, line => Int, column => Int, from_camel_case
37       => Bool, [ucfirst => Bool] )
38           Accepts either a "PPI::Document" to process or a string containing
39           the code (which will be converted into a "PPI::Document") to
40           process.  Renames the variable found at line, column with that
41           supplied in the "replacement" parameter and returns a
42           "PPIx::EditorTools::ReturnObject" with the new code available via
43           the "ppi" or "code" accessors, as a "PPI::Document" or "string",
44           respectively. The "PPI::Token" found at line, column is available
45           via the "element" accessor.
46
47           Instead of specifying an explicit replacement variable name, you
48           may choose to use the "to_camel_case" or "from_camel_case" options
49           that automatically convert to/from camelCase. In that mode, the
50           "ucfirst" option will force uppercasing of the first letter.
51
52           You can not specify a replacement name and use the
53           "to/from_camel_case" options.
54
55           Croaks with a "no token" exception if no token is found at the
56           location.  Croaks with a "no declaration" exception if unable to
57           find the declaration.
58

SEE ALSO

60       This class inherits from "PPIx::EditorTools".  Also see
61       App::EditorTools, Padre, and PPI.
62

AUTHORS

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