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).

File:
1 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 {
Note: See TracChangeset for help on using the changeset viewer.