Changeset 12640


Ignore:
Timestamp:
2006-09-01T11:05:08+12:00 (18 years ago)
Author:
mdewsnip
Message:

Now returns valid XML instead of an error when -listall and -describeall is specified and the directory doesn't exist (usually collection-specific).

Location:
trunk/gsdl/bin/script
Files:
4 edited

Legend:

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

    r12639 r12640  
    141141 
    142142    if ($listall || $describeall) {
    143     my $class_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "classify");
    144     if (!opendir (INDIR, $class_dir)) {
    145         print STDERR "classinfo.pl: could not open directory $class_dir\n";
     143    my $classify_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "classify");
     144    my @classifier_list = ();
     145    if (opendir (INDIR, $classify_dir)) {
     146        @classifier_list = grep (/\.pm$/, readdir (INDIR));
     147        closedir (INDIR);
    146148    }
    147     else {
    148         my @classifier_list = grep (/\.pm$/, readdir (INDIR));
    149         closedir (INDIR);
    150149
    151         print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    152         print STDERR "<ClassifyList length=\"" . scalar(@classifier_list) . "\">\n";
    153         foreach my $classifier (@classifier_list) {
    154         $classifier =~ s/\.pm$//;
    155         my $classifierobj = &classify::load_classifier_for_info ($classifier);
    156         if ($describeall) {
    157             $classifierobj->print_xml_usage(0);
    158         }
    159         else {
    160             $classifierobj->print_xml_usage(0, 1);
    161         }
     150    print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     151    print STDERR "<ClassifyList length=\"" . scalar(@classifier_list) . "\">\n";
     152    foreach my $classifier (@classifier_list) {
     153        $classifier =~ s/\.pm$//;
     154        my $classifierobj = &classify::load_classifier_for_info ($classifier);
     155        if ($describeall) {
     156        $classifierobj->print_xml_usage(0);
    162157        }
    163         print STDERR "</ClassifyList>\n";
     158        else {
     159        $classifierobj->print_xml_usage(0, 1);
     160        }
    164161    }
     162    print STDERR "</ClassifyList>\n";
    165163    }
    166164    else {
  • trunk/gsdl/bin/script/downloadinfo.pl

    r12639 r12640  
    159159
    160160    if ($listall || $describeall) {
    161     my $download_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "downloaders");
    162     if (!opendir (INDIR, $download_dir)) {
    163         print STDERR "downloadinfo.pl: could not open directory $download_dir\n";
    164     }
    165     else {
    166         my @downloader_list = grep (/Download\.pm$/, readdir (INDIR));
     161    my $downloaders_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "downloaders");
     162    my @downloader_list = ();
     163    if (opendir (INDIR, $downloaders_dir)) {
     164        @downloader_list = grep (/Download\.pm$/, readdir (INDIR));
    167165        closedir (INDIR);
    168 
    169         print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    170         print STDERR "<DownloadList length=\"" . scalar(@downloader_list) . "\">\n";
    171         foreach my $downloader (@downloader_list) {
    172         $downloader =~ s/\.pm$//;
    173         my $downloaderobj = &download::load_download ($downloader);
    174         if ($describeall) {
    175             $downloaderobj->print_xml_usage(0);
    176         }
    177         else {
    178             $downloaderobj->print_xml_usage(0, 1);
    179         }
     166    }
     167
     168    print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     169    print STDERR "<DownloadList length=\"" . scalar(@downloader_list) . "\">\n";
     170    foreach my $downloader (@downloader_list) {
     171        $downloader =~ s/\.pm$//;
     172        my $downloaderobj = &download::load_download ($downloader);
     173        if ($describeall) {
     174        $downloaderobj->print_xml_usage(0);
    180175        }
    181         print STDERR "</DownloadList>\n";
    182     }
     176        else {
     177        $downloaderobj->print_xml_usage(0, 1);
     178        }
     179    }
     180    print STDERR "</DownloadList>\n";
    183181    }
    184182    else {
  • trunk/gsdl/bin/script/pluginfo.pl

    r12639 r12640  
    161161
    162162    if ($listall || $describeall) {
    163     my $plugin_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "plugins");
    164     if (!opendir (INDIR, $plugin_dir)) {
    165         print STDERR "pluginfo.pl: could not open directory $plugin_dir\n";
    166     }
    167     else {
    168         my @plugin_list = grep (/Plug\.pm$/, readdir (INDIR));
     163    my $plugins_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "plugins");
     164    my @plugin_list = ();
     165    if (opendir (INDIR, $plugins_dir)) {
     166        @plugin_list = grep (/Plug\.pm$/, readdir (INDIR));
    169167        closedir (INDIR);
    170 
    171         print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    172         print STDERR "<PluginList length=\"" . scalar(@plugin_list) . "\">\n";
    173         foreach my $plugin (@plugin_list) {
    174         $plugin =~ s/\.pm$//;
    175         my $plugobj = &plugin::load_plugin_for_info ($plugin);
    176         if ($describeall) {
    177             $plugobj->print_xml_usage(0);
    178         }
    179         else {
    180             $plugobj->print_xml_usage(0, 1);
    181         }
     168    }
     169
     170    print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     171    print STDERR "<PluginList length=\"" . scalar(@plugin_list) . "\">\n";
     172    foreach my $plugin (@plugin_list) {
     173        $plugin =~ s/\.pm$//;
     174        my $plugobj = &plugin::load_plugin_for_info ($plugin);
     175        if ($describeall) {
     176        $plugobj->print_xml_usage(0);
    182177        }
    183         print STDERR "</PluginList>\n";
    184     }
     178        else {
     179        $plugobj->print_xml_usage(0, 1);
     180        }
     181    }
     182    print STDERR "</PluginList>\n";
    185183    }
    186184    else {
  • trunk/gsdl/bin/script/plugoutinfo.pl

    r12639 r12640  
    163163
    164164    if ($listall || $describeall) {
    165     my $plugout_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "plugouts");
    166     if (!opendir (INDIR, $plugout_dir)) {
    167         print STDERR "plugoutinfo.pl: could not open directory $plugout_dir\n";
    168     }
    169     else {
    170         my @plugout_list = grep (/Plugout\.pm$/, readdir (INDIR));
     165    my $plugouts_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "perllib", "plugouts");
     166    my @plugout_list = ();
     167    if (opendir (INDIR, $plugouts_dir)) {
     168        @plugout_list = grep (/Plugout\.pm$/, readdir (INDIR));
    171169        closedir (INDIR);
    172 
    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         }
     170    }
     171
     172    print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     173    print STDERR "<PlugoutList length=\"" . scalar(@plugout_list) . "\">\n";
     174    foreach my $plugout (@plugout_list) {
     175        $plugout =~ s/\.pm$//;
     176        my $plugoutobj = &plugout::load_plugout ($plugout);
     177        if ($describeall) {
     178        $plugoutobj->print_xml_usage(0);
    184179        }
    185         print STDERR "</PlugoutList>\n";
    186     }
     180        else {
     181        $plugoutobj->print_xml_usage(0, 1);
     182        }
     183    }
     184    print STDERR "</PlugoutList>\n";
    187185    }
    188186    else {
Note: See TracChangeset for help on using the changeset viewer.