X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=examples%2Ffind_naughty.pl;fp=examples%2Ffind_naughty.pl;h=fb5719ce50d87351874921ee90bbd0a804e87b67;hb=caa9a6008de8bbc9dddfb772bff67005c099d6dd;hp=fc5a750f549e490e2514bd1d6970724af20827f2;hpb=b2d8cef8551aa63c2718732e53392e7ebdd6c75f;p=perltidy.git diff --git a/examples/find_naughty.pl b/examples/find_naughty.pl index fc5a750..fb5719c 100644 --- a/examples/find_naughty.pl +++ b/examples/find_naughty.pl @@ -40,7 +40,7 @@ foreach my $source (@ARGV) { # The PerlTokenSearch package is an interface to perltidy which accepts a # source filehandle and looks for selected variables. # -# It works by making a a callback object with a write_line() method to +# It works by making a callback object with a write_line() method to # receive tokenized lines from perltidy. # # Usage: @@ -64,12 +64,15 @@ sub find_naughty { print "Testing File: $args{_source}\n"; # run perltidy, which will call $formatter's write_line() for each line - perltidy( + my $err=perltidy( 'source' => $args{_source}, 'formatter' => bless( \%args, __PACKAGE__ ), # callback object 'argv' => "-npro -se", # -npro : ignore .perltidyrc, # -se : errors to STDOUT ); + if ($err) { + die "Error calling perltidy\n"; + } } sub write_line {