The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl

=encoding UTF-8

=head1 NAME

whiter - script to fix whitespaces errors in files

=head1 SYNOPSIS

whiter [FILEs or DIRs or both]

 Options:

      --verbose         Scrip show filenames that are fixed
      --help            Show this message
      --version         Show version number

Script will work on text files that are specified as the parameters or are
situated in the specified diretories.

Script will check if all the rules are followed. In case if something is wrong
the script will fix the file.

=over

=item * Each line ends with "\n" (including the last line)

=item * For new lines "\n" is used (not "\r\n")

=item * There are no ending spaces on the lines

=item * 4 spaces are used instead of tabs

=item * No empty lines in the end of file

=back

There is also a script `L<test_whitespaces>` that checks all that ruls and
there is a Perl module L<Test::Whitespaces> that can be used to test your
source code.

Project url: L<https://github.com/bessarabov/Test-Whitespaces>

=head1 AUTHOR

Ivan Bessarabov, C<< <ivan@bessarabov.ru> >>

=head1 SOURCE CODE

The source code for this script is hosted on GitHub
L<https://github.com/bessarabov/Test-Whitespaces>

=cut

use strict;
use warnings;

use Test::Whitespaces { _only_load => 1 };

Test::Whitespaces::_run_script(
    script => 'whiter',
    dir => \&Test::Whitespaces::_fix_dir,
    file => \&Test::Whitespaces::_fix_file,
    argv => \@ARGV,
);