Skip to content

Instantly share code, notes, and snippets.

@autarch
Created September 25, 2012 15:05
Show Gist options
  • Save autarch/3782478 to your computer and use it in GitHub Desktop.
Save autarch/3782478 to your computer and use it in GitHub Desktop.
#!/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