Changeset 29678 for main/trunk/package-kits/scripts/gs-servlet.pl
- Timestamp:
- 2015-01-09T14:24:10+13:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/package-kits/scripts/gs-servlet.pl
r29674 r29678 9 9 10 10 use lib 'perllib'; 11 use XML::Tidy;11 use Greenstone::XML::Tidy; 12 12 13 13 my $hash; … … 39 39 "Parses XML from a file into the internal state\n input_file (- for STDIN)", 40 40 sub { 41 my $file = shift @ARGV; 42 my $new; 43 if ($file eq '-') { 44 if (isatty *STDIN) { 45 print STDERR "Reading XML from STDIN. Press ^D to end\n"; 46 } 47 $new = read_xml *STDIN; 48 } else { 49 open FH, '<', $file; 50 $new = read_xml *FH; 51 close FH; 52 } 41 my $new = read_xml shift @ARGV; 53 42 # Append the new data to the current data 54 43 for my $key (keys %$new) { … … 73 62 "Writes the current internal state as XML to a file\n output_file (- for STDOUT)", 74 63 sub { 75 my $file = shift @ARGV; 76 if ($file eq '-') { 77 write_xml $hash, *STDOUT; 78 } else { 79 open FH, '>', $file; 80 write_xml $hash, *FH; 81 close FH; 82 } 64 write_xml $hash, shift @ARGV; 83 65 }, 84 66 1,
Note:
See TracChangeset
for help on using the changeset viewer.