root/gsdl/trunk/bin/script/export.pl @ 14942

Revision 14942, 20.0 KB (checked in by davidb, 12 years ago)

Modification to support extensions. BEGIN block now adds perllib/ perllib/cpan to @INC for each extension.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# export.pl --
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 1999 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27
28
29# This program will export a particular collection into a specific Format (e.g. METS or DSpace)
30# Author: Chi-Yu Huang Date: 08-10-2004
31
32package export;
33
34BEGIN {
35    die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
36    die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
37    unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
38    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
39    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
40    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugouts");
41    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
42
43    if (defined $ENV{'GSDLEXTS'}) {
44    my @extensions = split(/:/,$ENV{'GSDLEXTS'});
45    foreach my $e (@extensions) {
46        my $ext_prefix = "$ENV{'GSDLHOME'}/ext/$e";
47
48        unshift (@INC, "$ext_prefix/perllib");
49        unshift (@INC, "$ext_prefix/perllib/cpan");
50    }
51    }
52}
53
54use strict;
55no strict 'refs'; # allow filehandles to be variables and vice versa
56no strict 'subs'; # allow barewords (eg STDERR) as function arguments
57
58use arcinfo;
59use colcfg;
60use plugin;
61use plugout;
62use manifest;
63use util;
64use scriptutil;
65use FileHandle;
66use gsprintf 'gsprintf';
67use printusage;
68use parse2;
69
70
71my $oidtype_list =
72    [ { 'name' => "hash",
73        'desc' => "{import.OIDtype.hash}" },
74      { 'name' => "assigned",
75        'desc' => "{import.OIDtype.assigned}" },
76      { 'name' => "incremental",
77        'desc' => "{import.OIDtype.incremental}" },
78      { 'name' => "dirname",
79        'desc' => "{import.OIDtype.dirname}" } ];
80
81#** define to use the METS format or DSpace format
82my $saveas_list =
83    [ { 'name' => "DSpace",
84        'desc' => "{export.saveas.DSpace}" },
85      { 'name' => "GreenstoneMETS",
86        'desc' => "{export.saveas.GreenstoneMETS}"},
87      { 'name' => "FedoraMETS",
88        'desc' => "{export.saveas.FedoraMETS}"},
89      { 'name' => "GA",
90        'desc' => "{export.saveas.GA}"},
91      { 'name' => "MARCXML",
92        'desc' => "{export.saveas.MARCXML}"}
93     ];
94
95
96# Possible attributes for each argument
97# name: The name of the argument
98# desc: A description (or more likely a reference to a description) for this argument
99# type: The type of control used to represent the argument. Options include: string, int, flag, regexp, metadata, language, enum etc
100# reqd: Is this argument required?
101# hiddengli: Is this argument hidden in GLI?
102# modegli: The lowest detail mode this argument is visible at in GLI
103
104my $saveas_argument =
105      { 'name' => "saveas",
106    'desc' => "{export.saveas}",
107    'type' => "enum",
108    'list' => $saveas_list,
109    'deft' => "METS",
110    'reqd' => "no",
111    'modegli' => "3" };
112
113
114my $arguments =
115    [
116      $saveas_argument,
117      { 'name' => "exportdir",
118    'desc' => "{export.exportdir}",
119    'type' => "string",
120    'reqd' => "no",
121        'hiddengli' => "yes" },
122      { 'name' => "importdir",
123    'desc' => "{import.importdir}",
124    'type' => "string",
125    'reqd' => "no",
126        'hiddengli' => "yes" },
127      { 'name' => "site",
128    'desc' => "{import.site}",
129    'type' => "string",
130    'deft' => "",
131    'reqd' => "no",
132        'hiddengli' => "yes" },
133      { 'name' => "collectdir",
134    'desc' => "{export.collectdir}",
135    'type' => "string",
136    # parsearg left "" as default
137    #'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"),
138    'deft' => "",
139    'reqd' => "no",
140    'hiddengli' => "yes" },
141      { 'name' => "manifest",
142    'desc' => "{import.manifest}",
143    'type' => "string",
144    'deft' => "",
145    'reqd' => "no",
146        'hiddengli' => "yes" },
147      { 'name' => "listall",
148    'desc' => "{export.listall}",
149    'type' => "flag",
150    'reqd' => "no" },
151      { 'name' => "debug",
152    'desc' => "{export.debug}",
153    'type' => "flag",
154    'reqd' => "no",
155        'hiddengli' => "yes" },
156      { 'name' => "faillog",
157    'desc' => "{export.faillog}",
158    'type' => "string",
159    'deft' => "",
160    'reqd' => "no",
161        'modegli' => "4" },
162      { 'name' => "incremental",
163    'desc' => "{import.incremental}",
164    'type' => "flag",
165    'hiddengli' => "yes" },
166      { 'name' => "keepold",
167    'desc' => "{export.keepold}",
168    'type' => "flag",
169    'reqd' => "no",
170    'hiddengli' => "yes" },
171      { 'name' => "removeold",
172    'desc' => "{export.removeold}",
173    'type' => "flag",
174    'reqd' => "no",
175    'modegli' => "3" },
176      { 'name' => "language",
177    'desc' => "{scripts.language}",
178    'type' => "string",
179    'reqd' => "no",
180    'modegli' => "4" },
181      { 'name' => "maxdocs",
182    'desc' => "{export.maxdocs}",
183    'type' => "int",
184    'reqd' => "no",
185    'range' => "1,",
186    'modegli' => "1" },
187      { 'name' => "OIDtype",
188    'desc' => "{import.OIDtype}",
189    'type' => "enum",
190    'list' => $oidtype_list,
191    # parsearg left "" as default
192    #'deft' => "hash",
193    'reqd' => "no",
194    'modegli' => "3" },
195      { 'name' => "OIDmetadata",
196    'desc' => "{import.OIDmetadata}",
197    'type' => "metadata",
198    'deft' => "dc.Identifier",
199    'reqd' => "no",
200    'modegli' => "3" },
201      { 'name' => "out",
202    'desc' => "{export.out}",
203    'type' => "string",
204    'deft' => "STDERR",
205    'reqd' => "no",
206        'hiddengli' => "yes" },
207      { 'name' => "statsfile",
208    'desc' => "{export.statsfile}",
209    'type' => "string",
210    'deft' => "STDERR",
211    'reqd' => "no",
212        'hiddengli' => "yes" },
213      { 'name' => "xsltfile",
214    'desc' => "{BasPlugout.xslt_file}",
215    'type' => "string",
216    'reqd' => "no",
217        'hiddengli' => "yes" },
218      { 'name' => "xslt_txt",
219    'desc' => "{METSPlugout.xslt_txt}",
220    'type' => "string",
221    'reqd' => "no",
222        'hiddengli' => "no" },
223      { 'name' => "xslt_mets",
224    'desc' => "{METSPlugout.xslt_mets}",
225    'type' => "string",
226    'reqd' => "no",
227        'hiddengli' => "no" },
228      { 'name' => "fedora_namespace",
229    'desc' => "{FedoraMETSPlugout.fedora_namespace}",
230    'type' => "string",
231    'deft' => "greenstone",
232    'reqd' => "no",
233        'hiddengli' => "no" },
234      { 'name' => "mapping_file",
235    'desc' => "{MARCXMLPlugout.mapping_file}",
236    'type' => "string",
237    'reqd' => "no",
238        'hiddengli' => "no" },
239      { 'name' => "group_marc",
240    'desc' => "{MARCXMLPlugout.group}",
241    'type' => "flag",
242    'reqd' => "no",
243        'hiddengli' => "no" },
244      { 'name' => "verbosity",
245    'desc' => "{export.verbosity}",
246    'type' => "int",
247    'range' => "0,3",
248    'deft' => "2",
249    'reqd' => "no",
250    'modegli' => "4" },
251      { 'name' => "gli",
252    'desc' => "",
253    'type' => "flag",
254    'reqd' => "no",
255    'hiddengli' => "yes" },
256      { 'name' => "xml",
257    'desc' => "{scripts.xml}",
258    'type' => "flag",
259    'reqd' => "no",
260    'hiddengli' => "yes" }
261      ];
262
263my $options = { 'name' => "export.pl",
264        'desc' => "{export.desc}",
265        'args' => $arguments };
266
267my $listall_options = { 'name' => "export.pl",
268                'desc' => "{export.desc}",
269                'args' => [ $saveas_argument ] };
270
271#sub gsprintf
272#{
273#    return &gsprintf::gsprintf(@_);
274#}
275
276
277sub store_collectionmeta
278{
279    my ($collectionmeta,$field,$doc_obj) = @_;
280
281    my $section = $doc_obj->get_top_section();
282
283    my $field_hash = $collectionmeta->{$field};
284
285    foreach my $k (keys %$field_hash)
286    {
287    my $val = $field_hash->{$k};
288
289
290### print STDERR "*** $k = $field_hash->{$k}\n";
291
292    my $md_label = "ex.$field";
293
294
295    if ($k =~ m/^\[l=(.*?)\]$/)
296    {
297
298        my $md_suffix = $1;
299        $md_label .= "^$md_suffix";
300    }
301
302
303    $doc_obj->add_utf8_metadata($section,$md_label, $val);
304   
305    if (($md_label eq "ex.collectionname^en") || ($md_label eq "ex.collectionname"))
306    {
307        $doc_obj->add_utf8_metadata($section,"dc.Title", $val);
308    }
309
310    }
311}
312
313
314&main();
315
316sub main {
317    # params
318    my ($language, $verbosity, $debug,
319    $importdir, $manifest, $incremental, $keepold,
320    $exportdir, $site, $listall,
321    $removeold, $saveas,
322    $OIDtype, $OIDmetadata,
323    $out, $faillog, $collectdir, $gli,
324    $gs_mode, $collectcfg,
325    $maxdocs, $statsfile,
326    $mapping_file,
327    $xsltfile,
328    $xslt_mets, $xslt_txt, $fedora_namespace, $group_marc);
329
330    my $xml = 0;
331   
332    # other vars
333    my ($configfilename, $collection,
334    $export_info_filename, $export_info,
335    $processor, $pluginfo);
336
337    my $service = "export";
338
339    my $hashParsingResult = {};
340    # general options available to all plugins
341    my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options");
342   
343    # If parse returns -1 then something has gone wrong
344    if ($intArgLeftinAfterParsing == -1)
345    {
346    &PrintUsage::print_txt_usage($options, "{export.params}");
347    die "\n";
348    }
349
350    foreach my $strVariable (keys %$hashParsingResult)
351    {
352    eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}";
353    }
354
355   
356    # these are options used by other things - we just set default values
357    # undef means will be set from config file if there
358    my $gzip = undef;
359    my $groupsize = 1;
360    #my $OIDtype = undef;
361    my $sortmeta = undef;
362
363    my $explicit_exportdir = (defined $exportdir) ? 1 : 0;
364
365    # save these command line settings. don't want config file settings in one
366    # coll used for other colls
367    # does this apply to other vars???
368    my $global_removeold = $removeold;
369    my $global_keepold = $keepold;
370    # If $language has been specified, load the appropriate resource bundle
371    # (Otherwise, the default resource bundle will be loaded automatically)
372    if ($language) {
373    &gsprintf::load_language_specific_resource_bundle($language);
374    }
375
376    if ($listall) {
377    if ($xml) {
378        &PrintUsage::print_xml_usage($listall_options);
379    }
380    else
381    {
382        &PrintUsage::print_txt_usage($listall_options,"{export.params}");
383    }
384    die "\n";
385    }
386    elsif ($xml) {
387        &PrintUsage::print_xml_usage($options);
388    die "\n";
389    }
390
391    # can have more than one collection name, 
392    # if the first extra option is -h, then output the help
393    if (scalar(@ARGV) == 0 || (@ARGV && $ARGV[0] =~ /^\-+h/)) {
394    &PrintUsage::print_txt_usage($options, "{export.params}");
395    die "\n";
396    }
397
398    if ($gli) { # the gli wants strings to be in UTF-8
399    &gsprintf::output_strings_in_UTF8;
400    }
401    my $close_out = 0;
402    if ($out !~ /^(STDERR|STDOUT)$/i) {
403    open (OUT, ">$out") ||
404        (&gsprintf(STDERR, "{common.cannot_open_output_file}\n", $out) && die);
405    $out = 'export::OUT';
406    $close_out = 1;
407    }
408    $out->autoflush(1);
409
410    while (scalar(@ARGV)>0) {
411    my $collect_name = shift @ARGV;
412    $ENV{'GSDLCOLLECTION'} = $collect_name;
413
414    eval {
415        # get and check the collection name
416        if (($collection = &colcfg::use_collection($site, $collect_name, $collectdir)) eq "") {
417        &PrintUsage::print_txt_usage($options, "{export.params}");
418        die "\n";
419        }
420        # add collection's perllib dir  into include path in
421        # case we have collection specific modules
422        unshift (@INC, "$ENV{'GSDLCOLLECTDIR'}/perllib");
423       
424        if ($faillog eq "") {
425        $faillog = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "etc", "fail.log");
426        }
427        open (FAILLOG, ">$faillog") ||
428        (&gsprintf(STDERR, "{export.cannot_open_fail_log}\n", $faillog) && die);
429        my $faillogname = $faillog;
430        $faillog = 'export::FAILLOG';
431        $faillog->autoflush(1);
432       
433        # check sortmeta
434        $sortmeta = undef unless defined $sortmeta && $sortmeta =~ /\S/;
435        if (defined $sortmeta && $groupsize > 1) {
436        &gsprintf($out, "{export.cannot_sort}\n\n");
437        $sortmeta = undef;
438        }
439       
440        # get the list of plugins for this collection and set any options that
441        # were specified in the collect.cfg (all export.pl options except
442        # -collectdir, -out and -faillog may be specified in the collect.cfg (these
443        # options must be known before we read the collect.cfg))
444        my $plugins = [];
445        my @global_opts = ();
446
447        # Read in the collection configuration file.
448        ($configfilename, $gs_mode) = &colcfg::get_collect_cfg_name($out);
449
450        if ($gs_mode eq "gs2") {
451        $collectcfg = &colcfg::read_collect_cfg ($configfilename);
452        } elsif ($gs_mode eq "gs3") {
453        $collectcfg = &colcfg::read_collection_cfg_xml ($configfilename);
454        }
455
456        if (defined $collectcfg->{'importdir'} && $importdir eq "") {
457        $importdir = $collectcfg->{'importdir'};
458        }
459        if (defined $collectcfg->{'exportdir'} && $exportdir eq "") {
460        $exportdir = $collectcfg->{'exportdir'};
461        }
462
463        # fill in the default import and export directories if none
464        # were supplied, turn all \ into / and remove trailing /
465        $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
466        $importdir =~ s/[\\\/]+/\//g;
467        $importdir =~ s/\/$//;
468        if (!-e $importdir) {
469        &gsprintf($out, "{import.no_import_dir}\n\n", $importdir);
470        die "\n";
471        }
472
473        $exportdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export") if $exportdir eq "";
474        $exportdir =~ s/[\\\/]+/\//g;
475        $exportdir =~ s/\/$//;
476
477        if (defined $collectcfg->{'plugin'}) {
478        $plugins = $collectcfg->{'plugin'};
479        }
480       
481        if ($verbosity !~ /\d+/) {
482        if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) {
483            $verbosity = $collectcfg->{'verbosity'};
484        } else {
485            $verbosity = 2; # the default
486        }
487        }
488
489        if (defined $collectcfg->{'gzip'} && !$gzip) {
490        if ($collectcfg->{'gzip'} =~ /^true$/i) {
491            $gzip = 1;
492        }
493        }
494        if ($maxdocs !~ /\-?\d+/) {
495        if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) {
496            $maxdocs = $collectcfg->{'maxdocs'};
497        } else {
498            $maxdocs = -1; # the default
499        }
500        }
501        if ($groupsize == 1) {
502        if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) {
503            $groupsize = $collectcfg->{'groupsize'};
504        }
505        }
506        if (!defined $OIDtype || ($OIDtype !~ /^(hash|incremental|assigned|dirname)$/)) {
507        if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental)$/) {
508            $OIDtype = $collectcfg->{'OIDtype'};
509        } else {
510            $OIDtype = "hash"; # the default
511        }
512        }
513        if (defined $collectcfg->{'sortmeta'} && $sortmeta eq "") {
514        $sortmeta = $collectcfg->{'sortmeta'};
515        }
516        if (defined $collectcfg->{'debug'} && $collectcfg->{'debug'} =~ /^true$/i) {
517        $debug = 1;
518        }
519        if (defined $collectcfg->{'gli'} && $collectcfg->{'gli'} =~ /^true$/i) {
520        $gli = 1;
521        }
522       
523        # global plugin stuff
524        if (defined $collectcfg->{'separate_cjk'}&& $collectcfg->{'separate_cjk'} =~ /^true$/i) {
525        push @global_opts, "-separate_cjk";
526        }
527       
528        ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($global_removeold, $global_keepold, 0, "export", $collectcfg);
529
530        $gli = 0 unless defined $gli;
531
532        print STDERR "<export>\n" if $gli;
533       
534        # fill in the default import and export directories if none
535        # were supplied, turn all \ into / and remove trailing /
536        $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
537        $importdir =~ s/[\\\/]+/\//g;
538        $importdir =~ s/\/$//;
539        $exportdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "export") if $exportdir eq "";
540        $exportdir =~ s/[\\\/]+/\//g;
541        $exportdir =~ s/\/$//;
542       
543        # load all the plugins
544        $pluginfo = &plugin::load_plugins ($plugins, $verbosity, $out, $faillog, \@global_opts);
545       
546        if (scalar(@$pluginfo) == 0) {
547        &gsprintf($out, "{import.no_plugins_loaded}\n");
548        die "\n";
549        }
550       
551        # remove the old contents of the export directory if needed
552        if ($removeold && -e $exportdir) {
553        &gsprintf($out, "{export.removing_export}\n");
554        &util::rm_r ($exportdir);
555        }
556       
557        # read the export information file
558       
559        # Export to DSpace Archive format or METs format
560        # If saveas=DSpace, a "contents" file will be created, otherwise "export.inf"
561       
562        # the plugouts should be doing this!!
563        if ($saveas eq "DSpace"){
564        $export_info_filename = &util::filename_cat ($exportdir, "contents");
565        } elsif ($saveas =~ m/^.*METS$/ || $saveas eq "GA" || $saveas eq "MARC" ) {
566        $export_info_filename = &util::filename_cat ($exportdir, "export.inf");
567        }
568       
569        $export_info = new arcinfo();
570        $export_info -> load_info ($export_info_filename); 
571       
572        my ($plugout);
573        if (defined $collectcfg->{'plugout'}) {
574        $plugout = $collectcfg->{'plugout'};
575        }
576        else{
577        if ($saveas !~ /^(GA|.*METS|DSpace|MARCXML)$/) {
578            push @$plugout,"GAPlugout";
579        }
580        else{
581            push @$plugout,$saveas."Plugout";
582        }
583        }
584
585        my $plugout_name = $plugout->[0];
586       
587        push @$plugout,("-output_info",$export_info) if (defined $export_info);
588        push @$plugout,("-verbosity",$verbosity) if (defined $verbosity);
589        push @$plugout,("-debug") if ($debug);
590        push @$plugout,("-gzip_output",$gzip) if (defined $gzip);
591        push @$plugout,("-group_size",$groupsize) if (defined $groupsize);
592        push @$plugout,("-output_handle",$out) if (defined $out);
593        push @$plugout,("-xslt_file",$xsltfile) if (defined $xsltfile);
594        push @$plugout,("-group") if ($group_marc && $plugout_name =~ m/^MARCXMLPlugout$/);
595        push @$plugout,("-mapping_file",$mapping_file) if (defined $mapping_file && $plugout_name =~ m/^MARCXMLPlugout$/);
596        push @$plugout,("-xslt_mets",$xslt_mets) if (defined $xslt_mets && $plugout_name =~ m/^.*METSPlugout$/);
597        push @$plugout,("-xslt_txt",$xslt_txt) if (defined $xslt_txt && $plugout_name =~ m/^.*METSPlugout$/);
598        push @$plugout,("-fedora_namespace",$fedora_namespace) if (defined $fedora_namespace && $plugout_name eq "FedoraMETSPlugout");
599
600        $processor = &plugout::load_plugout($plugout);   
601       
602        $processor->setoutputdir ($exportdir);
603       
604        $processor->set_sortmeta ($sortmeta) if defined $sortmeta;
605        $processor->set_OIDtype ($OIDtype, $OIDmetadata);
606       
607        &plugin::begin($pluginfo, $importdir, $processor, $maxdocs);
608       
609        # process the import directory
610        &plugin::read ($pluginfo, $importdir, "", {}, $processor, $maxdocs,0, $gli);
611
612        if ($saveas eq "FedoraMETS")
613        {
614        # create collection "doc obj" for Fedora that contains
615        # collection-level metadata
616
617        my $doc_obj = new doc($configfilename,"nonindexed_doc");
618        $doc_obj->set_OID("collection");
619
620        my $col_name = undef;
621        my $col_meta = $collectcfg->{'collectionmeta'};
622        if (defined $col_meta)
623        {
624            store_collectionmeta($col_meta,"collectionname",$doc_obj);
625            store_collectionmeta($col_meta,"collectioextra",$doc_obj);
626
627        }
628
629        $processor->process($doc_obj);
630        }
631       
632        &plugin::end($pluginfo, $processor);
633
634        &plugin::deinit($pluginfo, $processor);
635       
636        # write out the export information file
637        $processor->close_file_output() if $groupsize > 1;
638        $processor->close_group_output() if $processor->is_group();
639        if ($saveas =~ m/^.*METS$/) {
640        $export_info->save_info($export_info_filename);
641        }
642       
643        # write out export stats
644        my $close_stats = 0;
645        if ($statsfile !~ /^(STDERR|STDOUT)$/i) {
646        if (open (STATS, ">$statsfile")) {
647            $statsfile = 'import::STATS';
648            $close_stats = 1;
649        } else {
650            &gsprintf($out, "{import.cannot_open_stats_file}", $statsfile);
651            &gsprintf($out, "{import.stats_backup}\n");
652            $statsfile = 'STDERR';
653        }
654        }
655
656        &gsprintf($out, "\n");
657        &gsprintf($out, "*********************************************\n");
658
659        &plugin::write_stats($pluginfo, $statsfile, $faillogname, $gli);
660        if ($close_stats) {
661        close STATS;
662        }
663
664        &gsprintf($out, "*********************************************\n");
665
666        close OUT if $close_out;
667
668        close FAILLOG;
669    };
670
671    if ($@) {
672        print STDERR $@;
673    }
674
675##  $ENV{'GSDLCOLLECTION'} = undef;
676    $importdir = "";
677    $removeold = 0 if ($explicit_exportdir);
678
679    } # while processing ARGV
680   
681    &gsprintf($out, "\n");
682    &gsprintf($out, "*********************************************\n");
683    &gsprintf($out, "* {export.complete}\n");
684    &gsprintf($out, "*********************************************\n");   
685
686}
Note: See TracBrowser for help on using the browser.