All pastes #188533 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-10-02 07:08 UTC
rendered paste body
#!/usr/bin/env perl
use strict;
use warnings;
use Carp;

# Get the name of the file on which to do the tidydiff on
my $file = $ARGV[0];

die "Usage: $0 <perl-source-file>\n"
    if !defined($file);

# Check if the file is a plain file. If it's not then it's obviously
# not perl code.
die "'$file' is not a plain file\n"
    if !-f $file;

# Check if the file is readable to us.
die "Insufficient permissions to read file: '$file'\n"
    if !-R $file;

print `perltidy $file | diff $file - `;