Created
September 25, 2012 15:05
-
-
Save autarch/3782478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Perl::Tidy 20120714; | |
use Path::Class qw( file ); | |
my $file = shift; | |
if ($file) { | |
my $dir = file($file)->dir(); | |
my $profile = q{}; | |
DIR: | |
while ( $dir ne '/' ) { | |
for my $file ( $dir->file('perltidyrc'), $dir->file('.perltidyrc') ) { | |
if ( -f $file ) { | |
$profile = "-pro=$file"; | |
last DIR; | |
} | |
} | |
$dir = $dir->parent(); | |
} | |
exec "perltidy -q $profile"; | |
} | |
else { | |
exec "perltidy -q"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment