Changeset 14101 for trunk


Ignore:
Timestamp:
2007-05-28T08:58:01+12:00 (17 years ago)
Author:
xiao
Message:

add a wrapper to ensure the right version of XML::Parser is loaded given the version of Perl being used.

File:
1 edited

Legend:

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

    r14021 r14101  
    3030no strict 'refs';
    3131no strict 'subs';
     32
     33# Wrapper that ensures the right version of XML::Parser is loaded given
     34# the version of Perl being used.  Need to distinguish between Perl 5.6 and
     35# Perl 5.8
     36sub BEGIN {
     37    my $perl_dir;
     38
     39    # Note: $] encodes the version number of perl
     40    if ($]>5.008) {
     41    # perl 5.8.1 or above
     42    $perl_dir = "perl-5.8";
     43    }
     44    elsif ($]<5.008) {
     45    # assume perl 5.6
     46    $perl_dir = "perl-5.6";
     47    }
     48    else {
     49    print STDERR "Warning: Perl 5.8.0 is not a maintained release.\n";
     50    print STDERR "         Please upgrade to a newer version of Perl.\n";
     51    $perl_dir = "perl-5.8";
     52    }
     53
     54    if ($ENV{'GSDLOS'} !~ /^windows$/i) {
     55    # Use push to put this on the end, so an existing XML::Parser will be used by default
     56    push (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/$perl_dir");
     57    }
     58}
     59
    3260use XML::Parser;
    33  
     61
    3462# A mapping hash to resolve name descrepency between gs2 and gs3.
    3563my $nameMap = {"key" => "value",
     
    321349}
    322350
     351# Create the buildConfig.xml file for a specific collection
    323352sub write_cfg_file {
    324     # information needed from $collectcfg: defaultindex, defaultlevel, classifiers,
     353    # information needed from $collectcfg include: defaultindex, defaultlevel, classifiers,
    325354    # the rest is from $buildcfg
    326355    my ($buildoutfile, $buildcfg, $collectcfg) = @_;
     
    360389    &write_line('COLCFG', ["<serviceRackList>"]);
    361390
     391    # This serviceRack enables the collection to provide the oai metadata retrieve service, which is served by the OAIMetadataRetrieve.java class
     392    # For each collection, we write the following serviceRack in the collection's buildConfig.xml file as follows and also specify the metadata format this oai service provides in the rack. But whether this service is going to be put in use depends on its name appearing in the OAIConfig.xml.
     393    &write_line('COLCFG', ["<serviceRack name=\"OAIPMH\">"]);
     394
     395    # What metadata sets to support is collection specific and is specified in each collection's buildConfig.xml file. To support other metadata schema, simply add an OAIMetadataFormat element here.
     396    # The support of unqualified Dublin Core metadata set is mendatory in the oai specification.
     397    &write_line('COLCFG', ["<OAIMetadataFormat name=\"Dublin Core\">"]);
     398    &write_line('COLCFG', ["<metadataPrefix>oai_dc</metadataPrefix>"]);
     399    &write_line('COLCFG', ["<metadataNamespace>dc</metadataNamespace>"]);
     400    &write_line('COLCFG', ["</OAIMetadataFormat>"]);
     401   
     402    &write_line('COLCFG', ["</serviceRack>"]);
     403       
    362404    # do the search service
    363405    &write_line('COLCFG', ["<serviceRack name=\"GS2", $service_type, "Search\">"]);
Note: See TracChangeset for help on using the changeset viewer.