- Timestamp:
- 2011-04-11T16:55:18+12:00 (13 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/buildConfigxml.pm
r22485 r23895 35 35 no strict 'subs'; 36 36 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; 37 use XMLParser; 68 38 69 39 … … 94 64 } 95 65 66 # Removed ProtocolEncoding (see MetadataXMLPlugin for details) 67 96 68 # 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, 102 72 'Doctype' => \&Doctype 103 73 }); 104 }105 else {106 # Perl 5.8107 $parser = new XML::Parser('Style' => 'Stream',108 'ProtocolEncoding' => 'ISO-8859-1',109 'Handlers' => {'Char' => \&Char,110 'Doctype' => \&Doctype111 });112 }113 74 114 75 if (!open (COLCFG, $filename)) { -
main/trunk/greenstone2/perllib/collConfigxml.pm
r22485 r23895 31 31 no strict 'subs'; 32 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 36 sub BEGIN { 37 my $perl_dir; 38 39 # Note: $] encodes the version number of perl 40 if ($]>=5.010) { 41 $perl_dir = "perl-5.10"; 42 } 43 elsif ($]>5.008) { 44 # perl 5.8.1 or above 45 $perl_dir = "perl-5.8"; 46 } 47 elsif ($]<5.008) { 48 # assume perl 5.6 49 $perl_dir = "perl-5.6"; 50 } 51 else { 52 print STDERR "Warning: Perl 5.8.0 is not a maintained release.\n"; 53 print STDERR " Please upgrade to a newer version of Perl.\n"; 54 $perl_dir = "perl-5.8"; 55 } 56 57 if ($ENV{'GSDLOS'} !~ /^windows$/i) { 58 # Use push to put this on the end, so an existing XML::Parser will be used by default 59 push (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/$perl_dir"); 60 } 61 } 62 63 use XML::Parser; 33 use XMLParser; 64 34 65 35 # A mapping hash to resolve name discrepancy between gs2 and gs3. … … 126 96 } 127 97 98 # Removed ProtocolEncoding (see MetadataXMLPlugin for details) 99 128 100 # create XML::Parser object for parsing metadata.xml files 129 my $parser; 130 if ($]<5.008) { 131 # Perl 5.6 132 $parser = new XML::Parser('Style' => 'Stream', 133 'Handlers' => {'Char' => \&Char, 101 my $parser = new XML::Parser('Style' => 'Stream', 102 'Pkg' => 'collConfigxml', 103 'Handlers' => {'Char' => \&Char, 134 104 'Doctype' => \&Doctype 135 105 }); 136 }137 else {138 # Perl 5.8139 $parser = new XML::Parser('Style' => 'Stream',140 'ProtocolEncoding' => 'ISO-8859-1',141 'Handlers' => {'Char' => \&Char,142 'Doctype' => \&Doctype143 });144 }145 146 106 if (!open (COLCFG, $filename)) { 147 107 print STDERR "cfgread::read_cfg_file couldn't read the cfg file $filename\n"; -
main/trunk/greenstone2/perllib/plugins/MetadataXMLPlugin.pm
r23561 r23895 133 133 } 134 134 135 # The following used to be passed in as a parameter to XML::Parser, 136 # if the version of perl was greater than or equal to 5.8. 137 # The svn commit comment explaining the reason for adding this was 138 # not very clear and also said that it was quick fix and hadn't 139 # been tested under windows. 140 # More recent work has been to make strings in Perl "Unicode-aware" 141 # and so this line might actually be potentially harmful, however 142 # it is not the case that we encountered an actual error leading to 143 # its removal, rather it has been eliminated in an attempt to tighten 144 # up the code. For example, this protocol encoding is not used in 145 # ReadXMLFile. 146 # 'ProtocolEncoding' => 'ISO-8859-1', 147 135 148 # create XML::Parser object for parsing metadata.xml files 136 my $parser; 137 if ($]<5.008) { 138 # Perl 5.6 139 $parser = new XML::Parser('Style' => 'Stream', 149 my $parser = new XML::Parser('Style' => 'Stream', 140 150 'PluginObj' => $self, 151 'Pkg' => 'MetadataXMLPlugin', 141 152 'Handlers' => {'Char' => \&Char, 142 153 'Doctype' => \&Doctype 143 154 }); 144 }145 else {146 # Perl 5.8 or greater147 $parser = new XML::Parser('Style' => 'Stream',148 'PluginObj' => $self,149 'ProtocolEncoding' => 'ISO-8859-1',150 'Handlers' => {'Char' => \&Char,151 'Doctype' => \&Doctype152 });153 }154 155 155 156 $self->{'parser'} = $parser;
Note:
See TracChangeset
for help on using the changeset viewer.