Whitespace

Whitespace is a Perl module to cleanup various types of bogus whitespace in source files.
Download

Whitespace Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Rajesh Vaidheeswarran
  • Publisher web site:
  • http://search.cpan.org/~rvaidh/Whitespace-1.02/Whitespace.pm

Whitespace Tags


Whitespace Description

Whitespace is a Perl module to cleanup various types of bogus whitespace in source files. Whitespace is a Perl module to cleanup various types of bogus whitespace in source files.SYNOPSIS use Whitespace; # Instantiate a whitespace object with # both input and output files specified $ws = new Whitespace($infile, $outfile); # Instantiate a whitespace object with # only the input files specified (in-place cleanup) $ws2 = new Whitespace($infile); # Detect the whitespaces $ret = $ws->detect();detect returns undef if it is unable to operate on the given file.The error that caused the undef can be retrieved using error print $ws->error() . "n" unless defined $ret;detect returns the types of whitespaces detected as a hash which can be retrieved using the method status. The populated hash might look like this, if the file only had leading, trailing and end-of-line spaces (say on 3 lines). %stat = %{$env->status()}; print map "$_ => $stat{$_}n", sort keys %stat; eol => 3 indent => 0 leading => 1 spacetab => 0 trailing => 1Cleanup can be achieved for all the whitespaces or for just a given type of whitespace, using the following methods.If a outfile is given, the cleaned contents are written to this file. If not, the contents are replaced in-place. undef is returned if there was an error writing the file. # To cleanup the all the whitespaces $ret = $env->cleanup(); # To cleanup leading whitespaces only $leadstat = $env->leadclean(); # To cleanup trailing whitespaces only $trailstat = $env->trailclean(); # To cleanup indentation whitespaces only $indentstat = $env->indentclean(); # To cleanup space-followed-by-tabs only $sftstat = $env->spacetabclean(); # To cleanup end-of-line whitespaces only $eolstat = $env->eolclean(); Requirements: · Perl


Whitespace Related Software