Ignore:
Timestamp:
2006-08-31T14:08:40+12:00 (18 years ago)
Author:
mdewsnip
Message:

Merged the "-listall" and "-describeall" code, and made both always produce XML. The format of the XML has changed slightly too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/plugoutinfo.pl

    r12625 r12629  
    162162    }
    163163
    164     if ($listall) {
    165     my $plugout_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib","plugouts");
     164    if ($listall || $describeall) {
     165    my $plugout_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "plugouts");
    166166    if (!opendir (INDIR, $plugout_dir)) {
    167167        print STDERR "plugoutinfo.pl: could not open directory $plugout_dir\n";
     
    171171        closedir (INDIR);
    172172
    173         if ($xml) {
    174         my $num_plugouts = scalar(@plugout_list);
    175 
    176         print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    177         print STDERR "<PlugoutList length=\"$num_plugouts\">\n";
    178         map { print STDERR "  <PlugoutName>$_</PlugoutName>\n"; } @plugout_list;
    179         print STDERR "</PlugoutList>\n";
     173        print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     174        print STDERR "<PlugoutList length=\"" . scalar(@plugout_list) . "\">\n";
     175        foreach my $plugout (@plugout_list) {
     176        $plugout =~ s/\.pm$//;
     177        my $plugoutobj = &plugout::load_plugout ($plugout);
     178        if ($describeall) {
     179            $plugoutobj->print_xml_usage(0);
     180        }
     181        else {
     182            $plugoutobj->print_xml_usage(0, 1);
     183        }
    180184        }
    181         else {
    182         print STDERR join(" ",@plugout_list), "\n";
    183         }
    184     }
    185     }
    186     elsif ($describeall) {
    187     my $plugout_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"perllib","plugouts");
    188     my @plugout_list;
    189     if (!opendir (INDIR, $plugout_dir)) {
    190         print STDERR "plugoutinfo.pl: could not open directory $plugout_dir\n";
    191     }
    192     else {
    193         @plugout_list = grep (/Plugout\.pm$/, readdir (INDIR));
    194         closedir (INDIR);
    195     }
    196     #sort (@plugout_list);
    197     if ($xml) {
    198         my $num_plugout = scalar(@plugout_list);
    199         &PrintUsage::print_xml_header("plugout", 1);
    200         print STDERR "<PlugoutInfoList length=\"$num_plugout\">\n";
    201     }
    202     foreach my $pl (@plugout_list) {
    203         $pl =~ s/\.pm$//;
    204         &print_single_plugout($pl, $xml, 0);
    205     }
    206     if ($xml) {
    207         print STDERR "</PlugoutInfoList>\n";
     185        print STDERR "</PlugoutList>\n";
    208186    }
    209187    }
     
    212190    }
    213191}
     192
    214193
    215194sub print_single_plugout {
Note: See TracChangeset for help on using the changeset viewer.