Installation Problem with XML::Parser perl module

H

HarishN

I just installed the XML::parser and when I tried to run a test I see
this following error.
Parser.pm and Expat.pm versions don't match at
/my/local/harishn/perl-modules/lib/5.6.1/sun4-solaris/XML/Parser.pm
line 16.

I looked at the source code in these 2 modules.

package XML::parser;

use Carp;

BEGIN {
require XML::parser::Expat;
$VERSION = '2.34';
die "Parser.pm and Expat.pm versions don't match"
unless $VERSION eq $XML::parser::Expat::VERSION;
}

package XML::parser::Expat;

require 5.004;

use strict;
use vars qw($VERSION @ISA %Handler_Setters %Encoding_Table
@Encoding_Path
$have_File_Spec);
use Carp;

require DynaLoader;

@ISA = qw(DynaLoader);
$VERSION = "2.34" ;


I see both versions match but I still get the error. Can you anyone
help in resolving this ?


Thank you very much,
Harish
 
B

Ben Morrow

I just installed the XML::parser and when I tried to run a test I see
this following error.
Parser.pm and Expat.pm versions don't match at
/my/local/harishn/perl-modules/lib/5.6.1/sun4-solaris/XML/Parser.pm
line 16.

I looked at the source code in these 2 modules.

package XML::parser;

$VERSION = '2.34';

package XML::parser::Expat;

$VERSION = "2.34" ;

I see both versions match but I still get the error. Can you anyone
help in resolving this ?

Is there another XML/Parser/Expat.pm somewhere in @INC that is getting loaded
first?

Try adding

BEGIN {
$SIG{__DIE__} = sub {
die <<DIE
Parser.pm is $INC{'XML/Parser.pm'}
Expat.pm is $INC{'XML/Parser/Expat.pm'}
$@
DIE
}
}

at the top of your program.

Ben
 
A

Anno Siegel

[...]
Is there another XML/Parser/Expat.pm somewhere in @INC that is getting loaded
first?

Try adding

BEGIN {
$SIG{__DIE__} = sub {
die <<DIE
Parser.pm is $INC{'XML/Parser.pm'}
Expat.pm is $INC{'XML/Parser/Expat.pm'}
$@
DIE
}
}

at the top of your program.

Ugh, that won't work. It's interpolating $INC{ ...} before anything is
loaded. Did you mean to eval() something? Otherwise, $@ is useless.

Adapting things a bit, I came up with

BEGIN {
$SIG{__DIE__} = sub {
die "MyLib is $INC{ 'MyLib.pm'}\n" . shift;
}
}

use MyLib;

However, the sub is called tree times (accumulating identical messages)
when MyLib dies. I don't understand that offhand.

Anno
 
B

Ben Morrow

[...]
Is there another XML/Parser/Expat.pm somewhere in @INC that is getting loaded
first?

Try adding

BEGIN {
$SIG{__DIE__} = sub {
die <<DIE
Parser.pm is $INC{'XML/Parser.pm'}
Expat.pm is $INC{'XML/Parser/Expat.pm'}
$@
DIE
}
}

at the top of your program.

Ugh, that won't work. It's interpolating $INC{ ...} before anything is
loaded.

Eh? No it's not... $INC{...} is interpolated when the heredoc is
evaluated, not when it's compiled:

~% perl -e'BEGIN { $SIG{__DIE__}=sub{ die <<DIE'
-e'Fcntl is $INC{q/Fcntl.pm/}'
-e'$_[0]'
-e'DIE'
-e'} } use Fcntl qw/foo/'
Fcntl is /usr/lib/perl5/5.8.2/i686-linux-thread-multi/Fcntl.pm
"foo" is not exported by the Fcntl module
Can't continue after import errors at -e line 5
BEGIN failed--compilation aborted at -e line 5.
Did you mean to eval() something? Otherwise, $@ is useless.

No, that's just me getting $SIG{__DIE__}/$@ confused with END{}/$?...
I meant $_[0], of course.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top