Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattmartini/116253 to your computer and use it in GitHub Desktop.
Save mattmartini/116253 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/perl
################################################################################
################################################################################
## perl_clean.pl - filter to clean up perl code ##
## ##
## ##
## ##
## ##
## Useage: ##
## ##
## Author: $Author: martini $ ##
## ##
## Created: 5/25/06 v.1.0 ##
## ##
## Revisions: ##
## $Log: perl_clean.pl,v $
## Revision 1.1 2006/05/25 18:49:44 martini
## filter for BBEdit to clean (tidy) perl code
##
##
## ##
## ##
## ##
## Copyright: (c) 2006, Matt Martini ##
## ##
################################################################################
################################################################################
########################################
# Requirements and Packages #
########################################
use Perl::Tidy;
use constant VERSION => '$Revision: 1.1 $';
########################################
# Define Global Variables #
########################################
my ( $program, $debug );
$program = 'perl_clean.pl';
$debug = 1;
########################################
# Main Program #
########################################
my $source = '';
while (<>) {
$source .= $_;
}
my @destination;
Perl::Tidy::perltidy( source => \$source,
destination => \@destination );
foreach (@destination) {
print;
}
exit(0);
########################################
# Subroutines #
########################################
__END__
Put the following in your .perltidyrc file:
-ce
-lp
-cti=1
-i=4
-ci=2
-pt=1
-sbt=1
-bt=1
-bbt=1
-nsfs
-nolq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment