SYNOPSIS

    my $munged = PPIx::EditorTools::RenameVariable->new->rename(
        code        => $code,
        line        => 15,
        column      => 13,
        replacement => 'stuff',
    );
    my $code_as_strig = $munged->code;
    my $code_as_ppi   = $munged->ppi;
    my $location      = $munged->element->location;

DESCRIPTION

This module will lexically replace a variable name.

METHODS

new()

Constructor. Generally shouldn't be called with any arguments. Accepts either a \*(C`PPI::Document\*(C' to process or a string containing the code (which will be converted into a \*(C`PPI::Document\*(C') to process. Renames the variable found at line, column with that supplied in the \*(C`replacement\*(C' parameter and returns a \*(C`PPIx::EditorTools::ReturnObject\*(C' with the new code available via the \*(C`ppi\*(C' or \*(C`code\*(C' accessors, as a \*(C`PPI::Document\*(C' or \*(C`string\*(C', respectively. The \*(C`PPI::Token\*(C' found at line, column is available via the \*(C`element\*(C' accessor. Instead of specifying an explicit replacement variable name, you may choose to use the \*(C`to_camel_case\*(C' or \*(C`from_camel_case\*(C' options that automatically convert to/from camelCase. In that mode, the \*(C`ucfirst\*(C' option will force uppercasing of the first letter. You can not specify a replacement name and use the \*(C`to/from_camel_case\*(C' options. Croaks with a \*(L"no token\*(R" exception if no token is found at the location. Croaks with a \*(L"no declaration\*(R" exception if unable to find the declaration.

RELATED TO PPIx::EditorTools::RenameVariable…

This class inherits from \*(C`PPIx::EditorTools\*(C'. Also see App::EditorTools, Padre, and \s-1PPI\s0.