Ignore:
Timestamp:
2011-04-11T16:55:18+12:00 (13 years ago)
Author:
sjm84
Message:

Modified several Perl files to merge the locations where XML::Parser checked for the current version of perl into one location. Also tidied up several locations where a difference was specified between 5.6 and 5.8+ to do with ProtocolEncoding being used to initialise an XML::Parser. Given the recent "

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/buildConfigxml.pm

    r22485 r23895  
    3535no strict 'subs';
    3636
    37 # Wrapper that ensures the right version of XML::Parser is loaded given
    38 # the version of Perl being used.  Need to distinguish between Perl 5.6 and
    39 # Perl 5.8
    40 sub BEGIN {
    41     my $perl_dir;
    42 
    43     # Note: $] encodes the version number of perl
    44     if ($]>=5.010) {
    45     $perl_dir = "perl-5.10";
    46     }
    47     elsif ($]>5.008) {
    48     # perl 5.8.1 or above
    49     $perl_dir = "perl-5.8";
    50     }
    51     elsif ($]<5.008) {
    52     # assume perl 5.6
    53     $perl_dir = "perl-5.6";
    54     }
    55     else {
    56     print STDERR "Warning: Perl 5.8.0 is not a maintained release.\n";
    57     print STDERR "         Please upgrade to a newer version of Perl.\n";
    58     $perl_dir = "perl-5.8";
    59     }
    60 
    61     if ($ENV{'GSDLOS'} !~ /^windows$/i) {
    62     # Use push to put this on the end, so an existing XML::Parser will be used by default
    63     push (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/$perl_dir");
    64     }
    65 }
    66 
    67 use XML::Parser;
     37use XMLParser;
    6838
    6939
     
    9464    }
    9565
     66    # Removed ProtocolEncoding (see MetadataXMLPlugin for details)
     67
    9668    # create XML::Parser object for parsing metadata.xml files
    97     my $parser;
    98     if ($]<5.008) {
    99     # Perl 5.6
    100     $parser = new XML::Parser('Style' => 'Stream',
    101                   'Handlers' => {'Char' => \&Char,
     69    my $parser = new XML::Parser('Style' => 'Stream',
     70                 'Pkg' => 'buildConfigxml',
     71                 'Handlers' => {'Char' => \&Char,
    10272                         'Doctype' => \&Doctype
    10373                         });
    104     }
    105     else {
    106     # Perl 5.8
    107     $parser = new XML::Parser('Style' => 'Stream',
    108                   'ProtocolEncoding' => 'ISO-8859-1',
    109                   'Handlers' => {'Char' => \&Char,
    110                          'Doctype' => \&Doctype
    111                          });
    112     }
    11374
    11475    if (!open (COLCFG, $filename)) {
Note: See TracChangeset for help on using the changeset viewer.