Changeset 10340 for trunk/gsdl/bin/script/export.pl
- Timestamp:
- 2005-07-28T14:10:21+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/export.pl
r10162 r10340 41 41 } 42 42 43 use strict; 44 no strict 'refs'; # allow filehandles to be variables and vice versa 45 no strict 'subs'; # allow barewords (eg STDERR) as function arguments 46 43 47 use arcinfo; 44 48 use colcfg; … … 46 50 use docprint; 47 51 use util; 48 use parsargv;49 52 use FileHandle; 50 53 use gsprintf; 51 54 use printusage; 55 use parse2; 56 52 57 53 58 my $oidtype_list = … … 84 89 85 90 my $arguments = 86 [ { 'name' => "exportdir", 91 [ 92 $saveas_argument, 93 { 'name' => "saveas_version", 94 'desc' => "{export.saveas_version}", 95 'type' => "string", 96 'reqd' => "no" }, 97 { 'name' => "exportdir", 87 98 'desc' => "{export.exportdir}", 99 'type' => "string", 100 'reqd' => "no", 101 'hiddengli' => "yes" }, 102 { 'name' => "importdir", 103 'desc' => "{import.importdir}", 88 104 'type' => "string", 89 105 'reqd' => "no", … … 107 123 'desc' => "{export.faillog}", 108 124 'type' => "string", 109 'deft' => &util::filename_cat("<collectdir>", "colname", "etc", "fail.log"),125 'deft' => "", 110 126 'reqd' => "no", 111 127 'modegli' => "4" }, 112 { 'name' => "importdir",113 'desc' => "{import.importdir}",114 'type' => "string",115 'reqd' => "no",116 'hiddengli' => "yes" },117 128 { 'name' => "keepold", 118 129 'desc' => "{export.keepold}", … … 120 131 'reqd' => "no", 121 132 'hiddengli' => "yes" }, 133 { 'name' => "removeold", 134 'desc' => "{export.removeold}", 135 'type' => "flag", 136 'reqd' => "no", 137 'modegli' => "3" }, 122 138 { 'name' => "language", 123 139 'desc' => "{scripts.language}", … … 137 153 'reqd' => "no", 138 154 'hiddengli' => "yes" }, 139 { 'name' => "removeold",140 'desc' => "{export.removeold}",141 'type' => "flag",142 'reqd' => "no",143 'modegli' => "3" },144 $saveas_argument,145 155 { 'name' => "statsfile", 146 156 'desc' => "{export.statsfile}", … … 155 165 'deft' => "2", 156 166 'reqd' => "no", 157 'modegli' => "4" } ]; 167 'modegli' => "4" }, 168 { 'name' => "gli", 169 'desc' => "", 170 'type' => "flag", 171 'reqd' => "no", 172 'hiddengli' => "yes" }, 173 { 'name' => "xml", 174 'desc' => "{scripts.xml}", 175 'type' => "flag", 176 'reqd' => "no", 177 'hiddengli' => "yes" } 178 ]; 158 179 159 180 my $options = { 'name' => "export.pl", … … 174 195 175 196 sub main { 176 my ($verbosity, $importdir, $archivedir, $keepold, $listall, 177 $removeold, $saveas, $version, 178 $gzip, $groupsize, $OIDtype, $debug, 179 $maxdocs, $collection, $configfilename, 180 $pluginfo, $sortmeta, 181 $export_info_filename, $statsfile, 182 $export_info, $processor, $out, $faillog, $collectdir, $gli); 183 184 # ***** 11-04-03 - John Thompson ***** 197 # params 198 my ($language, $verbosity, $importdir, $exportdir, $keepold, $listall, 199 $removeold, $saveas, $saveas_version, $debug, 200 $maxdocs, $statsfile, $out, $faillog, $collectdir, $gli); 185 201 my $xml = 0; 186 # ************************************ 202 203 # other vars 204 my ($configfilename, $collection, $export_info_filename, $export_info, $processor, $pluginfo); 187 205 my $service = "export"; 188 206 189 # note that no defaults are passed for most options as they're set 190 # later (after we check the collect.cfg file) 191 if (!parsargv::parse(\@ARGV, 192 'language/.*/', \$language, 193 'verbosity/\d+/', \$verbosity, 194 'importdir/.*/', \$importdir, 195 'exportdir/.*/', \$exportdir, 196 'listall', \$listall, 197 'keepold', \$keepold, 198 'removeold', \$removeold, 199 'saveas/^(DSpace|METS|GA)$/METS', \$saveas, 200 'version/.*/', \$version, 201 'debug', \$debug, 202 'maxdocs/^\-?\d+/', \$maxdocs, 203 'collectdir/.*/', \$collectdir, 204 'out/.*/STDERR', \$out, 205 'statsfile/.*/STDERR', \$statsfile, 206 'faillog/.*/', \$faillog, 207 'gli', \$gli, 208 q^xml^, \$xml)) { 209 &PrintUsage::print_txt_usage($options, "{export.params}"); 210 die "\n"; 211 } 212 213 $gzip = undef; 214 $groupsize = 1; 215 $OIDtype = undef; 216 $sortmeta = undef; 207 my $hashParsingResult = {}; 208 my $blnParseFailed = "false"; 209 # general options available to all plugins 210 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 211 # can have more than one collection name, so don't check num args left 212 foreach my $strVariable (keys %$hashParsingResult) 213 { 214 eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}"; 215 } 216 217 218 # these are options used by other things - we just set default values 219 # undef means will be set from config file if there 220 my $gzip = undef; 221 my $groupsize = 1; 222 my $OIDtype = undef; 223 my $sortmeta = undef; 217 224 218 225 my $explicit_exportdir = (defined $exportdir) ? 1 : 0; … … 239 246 } 240 247 248 if (scalar(@ARGV) == 0) { 249 &PrintUsage::print_txt_usage($options, "{export.params}"); 250 die "\n"; 251 } 252 241 253 if ($gli) { # the gli wants strings to be in UTF-8 242 254 &gsprintf::output_strings_in_UTF8; … … 418 430 $processor->set_OIDtype ($OIDtype); 419 431 $processor->set_saveas ($saveas); 420 $processor->set_saveas_version ($ version);432 $processor->set_saveas_version ($saveas_version); 421 433 } else { 422 434 $processor = new docprint (); … … 476 488 $removeold = 0 if ($explicit_exportdir); 477 489 478 } 490 } # while processing ARGV 479 491 480 492 &gsprintf($out, "\n");
Note:
See TracChangeset
for help on using the changeset viewer.