[sword-svn] r332 - trunk/modules/misc_cleanup
refdoc at crosswire.org
refdoc at crosswire.org
Thu Jul 7 13:58:00 MST 2011
Author: refdoc
Date: 2011-07-07 13:58:00 -0700 (Thu, 07 Jul 2011)
New Revision: 332
Modified:
trunk/modules/misc_cleanup/title_cleanup.pl
Log:
use of STDOUT if no outputfile given
Modified: trunk/modules/misc_cleanup/title_cleanup.pl
===================================================================
--- trunk/modules/misc_cleanup/title_cleanup.pl 2011-07-07 20:44:20 UTC (rev 331)
+++ trunk/modules/misc_cleanup/title_cleanup.pl 2011-07-07 20:58:00 UTC (rev 332)
@@ -39,29 +39,25 @@
#########################################################################
use XML::LibXML;
-use utf8;
use strict;
+binmode (STDOUT,":utf8");
## Obtain arguments
if (scalar(@ARGV) < 1) {
print "\ntitle_cleanup.pl <osisWork> [-o outputfile] -- - fix output of usfm2osis.pl \n";
print "- Arguments in braces < > are required. Arguments in brackets [ ] are optional.\n";
- print "- If no -o option is specified for the output filename, the default output file is: \n\t<osisWork>.new\n";
+ print "- If no -o option is specified the output will go to <STDOUT>\n";
exit (-1);
}
my $file = @ARGV[0];
-my $nextarg = 1;
my $outputFilename;
-if (@ARGV[$nextarg] eq "-o") {
- $outputFilename = "@ARGV[$nextarg+1]";
- $nextarg += 2;
+if (@ARGV[1] eq "-o") {
+ $outputFilename = "@ARGV[2]";
+ open (OUTF, , ">:utf8", "$outputFilename") or die "Could not open file @ARGV[2] for writing.";
+ select(OUTF);
}
-else {
- $outputFilename = "$file.new";
-}
-open (OUTF, , ">", "$outputFilename") or die "Could not open file @ARGV[2] for writing.";
## Initialise OSIS file
@@ -79,5 +75,5 @@
}
}
-print OUTF $doc->toString('utf8');
+print $doc->toString();
More information about the sword-cvs
mailing list