Subject: | fix for broken -o option in js_beautify.pl |
Date: | Tue, 19 May 2015 16:33:40 +1000 (AEST) |
To: | bug-JavaScript-Beautifier [...] rt.cpan.org |
From: | David Shrimpton <d.shrimpton [...] its.uq.edu.au> |
Hi,
Fix for small bug in JavaScript::Beautifier 0.17
bin/js_beautify.pl -o outputfile option doesn't work.
The input file is always written over.
A fix is below:
diff -c js_beautify.pl js_beautify.pl.orig
*** js_beautify.pl 2015-05-19 16:18:50.869954709 +1000
--- js_beautify.pl.orig 2009-12-30 12:47:20.000000000 +1000
***************
*** 44,50 ****
if ( $params{output} or $params{o} ) {
my $to_file = $params{output} || $file;
! open(my $fh, '>', $to_file);
print $fh $pretty_js;
close($fh);
} else {
--- 44,50 ----
if ( $params{output} or $params{o} ) {
my $to_file = $params{output} || $file;
! open(my $fh, '>', $file);
print $fh $pretty_js;
close($fh);
} else {
***************
--
David Shrimpton