App-EditorTools-1.00

NAME

App::EditorTools - Command line tool for Perl code refactoring

VERSION

version 1.00

DESCRIPTION

App::EditorTools provides the editortools command line program that enables programming editors (Vim, Emacs, etc.) to take advantage of some sophisticated Perl refactoring tools. The tools utilize PPI to analyze Perl code and make intelligent changes. As of this release, editortools is able to:

Lexically Rename a Variable

Introduce a Temporary Variable

Rename the Package Based on the Path of the File

More refactoring tools are expected to be added in the future.

NAME

App::EditorTools - Command line tool for Perl code refactoring

BACKGROUND

The Padre Perl editor team developed some very interesting PPI based refactoring tools for their editor. Working with the Padre team, those routines were abstracted into PPIx::EditorTools in order to make them available to alternative editors.

The initial implementation was developed for Vim. Pat Regan contributed the emacs bindings. Other editor bindings are encouraged/welcome.

REFACTORINGS

The following lists the refactoring routines that are currently supported. Please see App::EditorTools::Vim or App::EditorTools::Emacs to learn how to install the bindings and the short cuts to use within your editor. The command line interface should only be needed to develop the editor bindings.

Each command expects the Perl program being edited to be piped in via STDIN. The refactored code is output on STDOUT.

RenameVariable

editortools renamevariable -c col -l line -r newvar

Renames the variable at column col and line line to newvar. Unlike editors typical find and replace, this is aware of lexical scope and only renames those variables within same scope. For example, given:

Change the package declaration in the current file to reflect filename. Typically this is used when you want to rename a module. Move the module to a new location and pass the new filename to the editortools command. For example, if you are editing lib/App/EditorTools.pm the package declaration will be changed to package App::EditorTools;. At the moment there must be a valid package declaration in the file for this to work.

If the filename is a file that exists in the system, then renamepackagefrompath will attempt to resolve any symlinks. This allows us work on files under a symlink (ie, M@ -> lib/App/Model), but rename them correctly.

RenamePackage

editortools renamepackage -n Package::Name

Change the package declaration in the current file to Package::Name. At the moment there must be a valid package declaration in the file for this to work.

As a valued partner and proud supporter of MetaCPAN, StickerYou is
happy to offer a 10% discount on all Custom Stickers,
Business Labels, Roll Labels,
Vinyl Lettering or Custom Decals. StickerYou.com
is your one-stop shop to make your business stick.
Use code METACPAN10 at checkout to apply your discount.