Installation Problem with XML::Parser perl module

Discussion in 'Perl Misc' started by HarishN, Feb 20, 2004.

  1. HarishN

    HarishN Guest

    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
     
    HarishN, Feb 20, 2004
    #1
    1. Advertising

  2. HarishN

    Ben Morrow Guest

    (HarishN) wrote:
    > 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

    --
    perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
    qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
    1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
    2047502190/' #
     
    Ben Morrow, Feb 21, 2004
    #2
    1. Advertising

  3. HarishN

    Anno Siegel Guest

    Ben Morrow <> wrote in comp.lang.perl.misc:

    [...]

    > 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
     
    Anno Siegel, Feb 22, 2004
    #3
  4. HarishN

    Ben Morrow Guest

    -berlin.de (Anno Siegel) wrote:
    > Ben Morrow <> wrote in comp.lang.perl.misc:
    >
    > [...]
    >
    > > 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

    --
    perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
    qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
    1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
    2047502190/' #
     
    Ben Morrow, Feb 22, 2004
    #4
  5. HarishN

    Anno Siegel Guest

    Ben Morrow <> wrote in comp.lang.perl.misc:
    >
    > -berlin.de (Anno Siegel) wrote:
    > > Ben Morrow <> wrote in comp.lang.perl.misc:


    [...]

    > > > 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:


    You're right. Sorry for the false alarm.

    Anno
     
    Anno Siegel, Feb 23, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhinav
    Replies:
    3
    Views:
    131
    Abhinav
    May 28, 2004
  2. arne
    Replies:
    0
    Views:
    371
  3. Sean
    Replies:
    3
    Views:
    305
    robic0
    Oct 3, 2006
  4. Sean
    Replies:
    0
    Views:
    383
  5. sridhar reddy
    Replies:
    1
    Views:
    386
    Marc Girod
    Oct 17, 2012
Loading...

Share This Page