Take me over?
NAME
Code::TidyAll - Engine for tidyall, your all-in-one code tidier and validator
VERSION
version 0.02
SYNOPSIS
use Code::TidyAll;
my $ct = Code::TidyAll->new(
conf_file => '/path/to/conf/file'
);
# or
my $ct = Code::TidyAll->new(
root_dir => '/path/to/root',
plugins => {
perltidy => {
select => qr/\.(pl|pm|t)$/,
options => { argv => '-noll -it=2' },
},
...
}
);
# then...
$ct->process_files($file1, $file2);
# or
$ct->process_all();
DESCRIPTION
This is the engine used by tidyall - read that first to get an overview.
You can call this API from your own program instead of executing tidyall.
CONSTRUCTOR OPTIONS
You must either pass conf_file, or both plugins and root_dir.
- plugins
-
Specify a hash of plugins, each of which is itself a hash of options. This is equivalent to what would be parsed out of the sections in
tidyall.ini. - prefilter
-
A code reference that will be applied to code before processing. It is expected to take the full content as a string in its input, and output the transformed content.
- postfilter
-
A code reference that will be applied to code after processing. It is expected to take the full content as a string in its input, and output the transformed content.
- backup_ttl
- check_only
- conf_file
- data_dir
- mode
- no_backups
- no_cache
- root_dir
- quiet
- verbose
-
These options are the same as the equivalent
tidyallcommand-line options, replacing dashes with underscore (e.g. thebackup-ttloption becomesbackup_ttlhere).
METHODS
- process_all
-
Process all files; this implements the
tidyall -aoption. - process_files (file, ...)
-
Calls "process_file" on each file. Return a list of Code::TidyAll::Result objects, one for each file.
- process_file (file)
-
Process the file, meaning
Check the cache and return immediately if file has not changed
Apply prefilters, appropriate matching plugins, and postfilters
Print success or failure result to STDOUT, depending on quiet/verbose settings
Write the cache if enabled
Return a Code::TidyAll::Result object
- find_conf_file (start_dir)
-
Start in the start_dir and work upwards, looking for a
tidyall.ini. Return the pathname if found or throw an error if not found.
SEE ALSO
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.