source: main/trunk/greenstone2/perllib/XMLParser.pm@ 21822

Last change on this file since 21822 was 21822, checked in by ak19, 12 years ago

Dr Bainbridge has fixed several perl files that depended on perl 5.8 to work and used to fail with Perl 5.10.

  • Property svn:keywords set to Author Date Id Revision
File size: 936 bytes
Line 
1# Wrapper that ensures the right version of XML::Parser is loaded given
2# the version of Perl being used. Need to distinguish between Perl 5.6 and
3# Perl 5.8
4
5
6sub BEGIN {
7 my $perl_dir;
8
9 # Note: $] encodes the version number of perl
10 if ($]>=5.010) {
11 $perl_dir = "perl-5.10";
12 }
13 elsif ($]>5.008) {
14 # perl 5.8.1 or above
15 $perl_dir = "perl-5.8";
16 }
17 elsif ($]>=5.008) {
18 # perl 5.8.1 or above
19 $perl_dir = "perl-5.8";
20 }
21 elsif ($]<5.008) {
22 # assume perl 5.6
23 $perl_dir = "perl-5.6";
24 }
25 else {
26 print STDERR "Warning: Perl 5.8.0 is not a maintained release.\n";
27 print STDERR " Please upgrade to a newer version of Perl.\n";
28 $perl_dir = "perl-5.8";
29 }
30
31 if ($ENV{'GSDLOS'} !~ /^windows$/i) {
32 # Use push to put this on the end, so an existing XML::Parser will be used by default
33 push (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/$perl_dir");
34 }
35}
36
37use XML::Parser;
38use strict;
39
401;
Note: See TracBrowser for help on using the repository browser.