1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
use strict;
use Perl::Tidy;
my $source_string = <<'EOT';
my$error=Perl::Tidy::perltidy(argv=>$argv,source=>\$source_string,
destination=>\$dest_string,stderr=>\$stderr_string,
errorfile=>\$errorfile_string,);
EOT
my $dest_string;
my $stderr_string;
my $errorfile_string;
my $argv = "-npro";
$argv .= " -pbp";
$argv .= " -nst";
$argv .= " -se";
print "<<RAW SOURCE>>\n$source_string\n";
my $error = Perl::Tidy::perltidy(
argv => $argv,
source => \$source_string,
destination => \$dest_string,
stderr => \$stderr_string,
errorfile => \$errorfile_string,
);
if ($error) {
print "<<STDERR>>\n$stderr_string\n";
die "Exiting because of serious errors\n";
}
if ($dest_string) { print "<<TIDIED SOURCE>>\n$dest_string\n" }
if ($stderr_string) { print "<<STDERR>>\n$stderr_string\n" }
if ($errorfile_string) { print "<<.ERR file>>\n$errorfile_string\n" }
|