[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-Modules] Strange error from XML::Parser::Expat?



I have XML::Parser::Expat 2.26, and have been using it for a while with good results both on my (7300) mac at home and on my (Sun4) ISP.

I hadn't used it for about two weeks on my mac at home, and suddenly I'm getting strange errors when I run it in MacPerl (with the debugger on or off, doesn't matter).  Oddly, the errors occur in different places in the Parser/Expat code depending on whether the debugger is on or off.

I've whittled my script down to just the parse, and the XML document to one empty object, and I still get the error.

Since it used to work fine with the debugger from BBEdit (I wouldn't have been able to get my script running without it), and neither the script nor the XML file are very complex, I don't think getting the next XML::Parser release is the answer (although I figure I'm going to do that eventually anyway).

I'm sure it's something simple, but I can't figure out what to try next.

Here is the script, the xml file, and the error output:

------------------script contents-----------------------------
#!/local/bin/perl5.004 -w

require XML::Parser;

$GSTBOOK = "<guestbook.xml";

if ( open GSTBOOK ) {
    my $parseGuest = new XML::Parser( Style => 'Tree' );
    my $guestTree = $parseGuest->parse( *GSTBOOK );
    close( GSTBOOK );
}
------------------script end----------------------------------

note:  I tried removing the assignment at the beginning
       and saying ' open GSTBOOK, "<guestbook.xml" ' and
       it does the same thing.
note:  I tried 'use XML::Parser' and it does the same
       thing (only much faster)
note:  I tried opening with '+<' access and it does the
       same thing.


------------------guestbook.xml contents----------------------
<?xml version='1.0'?>
<guestbook>
</guestbook>
------------------guestbook.xml end---------------------------

note:  I put simple contents into the guestbook object and
       it does the same thing.


------------------output when run with debugger---------------
# # Modification of a read-only value attempted, <IN> chunk 1.
File 'Apps:Development:MacPerl:lib:perl5db.pl'; Line 1144
# 	XML::Parser::Expat::setHandlers('XML::Parser::Expat=HASH(0x3515844)', 'ExternEnt', 'CODE(0x36ddaf8)', 'Char', 'CODE(0x36e06a0)', 'Start', 'CODE(0x36e02d0)', 'End', ...) called
File 'Apps:Development:MacPerl:site_perl:XML:Parser.pm'; Line 162
# 	XML::Parser::parse('XML::Parser=HASH(0x3941624)', '*main::GSTBOOK') called
File 'Rudi:Web:cgi-bin:rudi:guestbook:test.pl'; Line 9
------------------output end----------------------------------

note: Parser.pm line 162 is:
  $expat->setHandlers(%handlers);


------------------output when run w/o debugger----------------
# # Modification of a read-only value attempted.
File 'Apps:Development:MacPerl:site_perl:XML:Parser:Expat.pm'; Line 126
------------------output end----------------------------------

note: Expat.pm line 126 is:
    my $old = &$hndl($self->{Parser}, $handler);




==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-modules-request@macperl.org