[22734] | 1 | ###########################################################################
|
---|
| 2 | #
|
---|
| 3 | # XMLParser.pm -- Wrapper that ensures the right version of XML::Parser
|
---|
| 4 | # is loaded given the version of Perl being used. Need
|
---|
| 5 | # to distinguish between Perl 5.6 and Perl 5.8
|
---|
| 6 | #
|
---|
| 7 | # A component of the Greenstone digital library software
|
---|
| 8 | # from the New Zealand Digital Library Project at the
|
---|
| 9 | # University of Waikato, New Zealand.
|
---|
| 10 | #
|
---|
| 11 | # Copyright (C) 2005-2010 New Zealand Digital Library Project
|
---|
| 12 | #
|
---|
| 13 | # This program is free software; you can redistribute it and/or modify
|
---|
| 14 | # it under the terms of the GNU General Public License as published by
|
---|
| 15 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 16 | # (at your option) any later version.
|
---|
| 17 | #
|
---|
| 18 | # This program is distributed in the hope that it will be useful,
|
---|
| 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 21 | # GNU General Public License for more details.
|
---|
| 22 | #
|
---|
| 23 | # You should have received a copy of the GNU General Public License
|
---|
| 24 | # along with this program; if not, write to the Free Software
|
---|
| 25 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 26 | #
|
---|
| 27 | ###########################################################################
|
---|
[8069] | 28 |
|
---|
| 29 |
|
---|
| 30 | sub BEGIN {
|
---|
| 31 | my $perl_dir;
|
---|
| 32 |
|
---|
| 33 | # Note: $] encodes the version number of perl
|
---|
[21822] | 34 | if ($]>=5.010) {
|
---|
| 35 | $perl_dir = "perl-5.10";
|
---|
| 36 | }
|
---|
| 37 | elsif ($]>5.008) {
|
---|
[8069] | 38 | # perl 5.8.1 or above
|
---|
| 39 | $perl_dir = "perl-5.8";
|
---|
| 40 | }
|
---|
[21822] | 41 | elsif ($]>=5.008) {
|
---|
| 42 | # perl 5.8.1 or above
|
---|
| 43 | $perl_dir = "perl-5.8";
|
---|
| 44 | }
|
---|
[8069] | 45 | elsif ($]<5.008) {
|
---|
| 46 | # assume perl 5.6
|
---|
| 47 | $perl_dir = "perl-5.6";
|
---|
| 48 | }
|
---|
| 49 | else {
|
---|
| 50 | print STDERR "Warning: Perl 5.8.0 is not a maintained release.\n";
|
---|
| 51 | print STDERR " Please upgrade to a newer version of Perl.\n";
|
---|
| 52 | $perl_dir = "perl-5.8";
|
---|
| 53 | }
|
---|
| 54 |
|
---|
[8087] | 55 | if ($ENV{'GSDLOS'} !~ /^windows$/i) {
|
---|
[9239] | 56 | # Use push to put this on the end, so an existing XML::Parser will be used by default
|
---|
| 57 | push (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/$perl_dir");
|
---|
[8087] | 58 | }
|
---|
[8069] | 59 | }
|
---|
| 60 |
|
---|
| 61 | use XML::Parser;
|
---|
[15894] | 62 | use strict;
|
---|
[8069] | 63 |
|
---|
| 64 | 1;
|
---|