NAME

Code::TidyAll::Plugin - Create plugins for tidying or validating code

VERSION

version 0.02

SYNOPSIS

To use a tidier or validator with tidyall it must have a corresponding plugin class that inherits from this class. This document describes how to implement a new plugin.

The easiest way to start is to look at existing plugins, such as Code::TidyAll::Plugin::PerlTidy and Code::TidyAll::Plugin::PerlCritic.

NAMING

If you are going to publicly release your plugin, call it 'Code::TidyAll::Plugin::something' so that users can find it easily and refer to it by its short name in configuration.

If it's an internal plugin, you can call it whatever you like and refer to it with a plus sign prefix in the config file, e.g.

[+My::Tidier::Class]
select = **/*.{pl,pm,t}

METHODS

Your class should define one and only one of these methods. The first two methods are for tidiers (which actually modify code); the second two are for validators (which simply check code for errors). tidyall can be a bit more efficient with the latter, e.g. avoid a file copy.

process_source ($source)

Receives source code as a string; returns the processed string, or dies with error.

process_file ($file)

Receives filename; processes the file in place, or dies with error. Note that the file will be a temporary copy of the user's file with the same basename; your changes will only propagate back if there was no error reported from any plugin.

validate_source ($source)

Receives source code as a string; dies with error if invalid. Return value will be ignored.

validate_file ($file)

Receives filename; validates file and dies with error if invalid. Should not modify file!

SEE ALSO

Code::TidyAll

AUTHOR

Jonathan Swartz <swartz@pobox.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Jonathan Swartz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.