]> git.donarmstrong.com Git - perltidy.git/blobdiff - examples/perlmask.pl
add missing newlines at the end of these documents
[perltidy.git] / examples / perlmask.pl
index 4302afeca5c06ca689edf0e30e73f663547350f7..5d94e4fd6f28e23313a9f8d6dca9d32f5f6374c0 100644 (file)
@@ -80,7 +80,7 @@ if ($masked_file) { print $masked_file; }
 # a string or array.  It can also optionally return the original file
 # as a string or array.
 #
-# It works by making 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.  This write_line method
 # selectively replaces tokens with either their original text or with a
 # benign masking character (such as '#' or 'Q').
@@ -126,12 +126,15 @@ EOM
     }
 
     # 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 print_line {