Ignore:
Timestamp:
1999-02-02T22:59:06+13:00 (25 years ago)
Author:
rjmcnab
Message:

Used GSDLCOLLECTDIR which is now defined in util.pm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/util.pm

    r86 r135  
    362362
    363363
     364# will return the collection name if successful, "" otherwise
     365sub use_collection {
     366    my ($collection) = @_;
     367
     368    # get and check the collection
     369    if (!defined($collection) || $collection eq "") {
     370    if (defined $ENV{'GSDLCOLLECTION'}) {
     371        $collection = $ENV{'GSDLCOLLECTION'};
     372    } else {
     373        print STDERR "No collection specified\n";
     374        return "";
     375    }
     376    }
     377   
     378    if ($collection eq "modelcol") {
     379    print STDERR "You can't use modelcol.\n";
     380    return "";
     381    }
     382
     383    # make sure the environment variables GSDLCOLLECTION and GSDLCOLLECTDIR
     384    # are defined
     385    $ENV{'GSDLCOLLECTION'} = $collection unless defined $ENV{'GSDLCOLLECTION'};
     386    $ENV{'GSDLCOLLECTDIR'} = "$ENV{'GSDLHOME'}/collect/$collection";
     387
     388    # make sure this collection exists
     389    if (!-e $ENV{'GSDLCOLLECTDIR'}) {
     390    print STDERR "Invalid collection ($collection).\n";
     391    return "";
     392    }
     393
     394    # everything is ready to go
     395    return $collection;
     396}
     397
    3643981;
Note: See TracChangeset for help on using the changeset viewer.