3 # example call to perltidy from man page documentation of Perl::Tidy
8 my $source_string = <<'EOT';
9 my$error=Perl::Tidy::perltidy(argv=>$argv,source=>\$source_string,
10 destination=>\$dest_string,stderr=>\$stderr_string,
11 errorfile=>\$errorfile_string,);
17 my $argv = "-npro"; # Ignore any .perltidyrc at this site
18 $argv .= " -pbp"; # Format according to perl best practices
19 $argv .= " -nst"; # Must turn off -st in case -pbp is specified
20 $argv .= " -se"; # -se appends the errorfile to stderr
21 ## $argv .= " --spell-check"; # uncomment to trigger an error
23 print "<<RAW SOURCE>>\n$source_string\n";
25 my $error = Perl::Tidy::perltidy(
27 source => \$source_string,
28 destination => \$dest_string,
29 stderr => \$stderr_string,
30 errorfile => \$errorfile_string, # not used when -se flag is set
31 ##phasers => 'stun', # uncomment to trigger an error
36 # serious error in input parameters, no tidied output
37 print "<<STDERR>>\n$stderr_string\n";
38 die "Exiting because of serious errors\n";
41 if ($dest_string) { print "<<TIDIED SOURCE>>\n$dest_string\n" }
42 if ($stderr_string) { print "<<STDERR>>\n$stderr_string\n" }
43 if ($errorfile_string) { print "<<.ERR file>>\n$errorfile_string\n" }