# Wrapper that ensures the right version of XML::Parser is loaded given
# the version of Perl being used.  Need to distinguish between Perl 5.6 and
# Perl 5.8


sub BEGIN {
    my $perl_dir;

    # Note: $] encodes the version number of perl
    if ($]>=5.010) { 
	$perl_dir = "perl-5.10";
    }
    elsif ($]>5.008) { 
	# perl 5.8.1 or above
	$perl_dir = "perl-5.8";
    }
    elsif ($]>=5.008) { 
	# perl 5.8.1 or above
	$perl_dir = "perl-5.8";
    }
    elsif ($]<5.008) {
	# assume perl 5.6
	$perl_dir = "perl-5.6";
    }
    else {
	print STDERR "Warning: Perl 5.8.0 is not a maintained release.\n";
	print STDERR "         Please upgrade to a newer version of Perl.\n";
	$perl_dir = "perl-5.8";
    }

    if ($ENV{'GSDLOS'} !~ /^windows$/i) {
	# Use push to put this on the end, so an existing XML::Parser will be used by default
	push (@INC, "$ENV{'GSDLHOME'}/perllib/cpan/$perl_dir");
    }
}

use XML::Parser;
use strict;

1;
