in reply to Perl panicking XML::LibXML::Reader copyCurrentNode

FWIW, I can't reproduce this on Linux + Perl 5.26 + XML::LibXML::Reader 2.0132, although the bug tracker shows quite a few bugs that could explain the problem. Have you tried upgrading your XML-LibXML? If that doesn't help, do you have the possibility to upgrade your entire Perl? (Strawberry Perl 5.16.3.1 comes with libxml2-2.9.0 and XML-LibXML 2.0014, while Strawberry Perl 5.26.2.1 comes with libxml2-2.9.4 and XML-LibXML 2.0132.)

It could of course in theory also be a problem with the input data, which you haven't shown - if you could provide a minimal sample that still causes your Perl to crash, that might help. See Short, Self-Contained, Correct Example.

Update: The sample data you provided (Update 2: I hope I found the right TBXcoreStructV02.dtd file on the net) still doesn't cause it to crash on my machine, which means it's likely a problem with your version of XML-LibXML and/or libxml2 (or, IMO less likely, your Perl 5.16).

Replies are listed 'Best First'.
Re^2: Perl panicking XML::LibXML::Reader copyCurrentNode (updated)
by IB2017 (Pilgrim) on Apr 30, 2018 at 13:32 UTC

    Thank you for your feedbacks. While I was preparing a snippet of my input data, I discovered the following: if I delete from my input file the first two lines

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE martif SYSTEM "TBXcoreStructV02.dtd">

    my Perl doesn't crash. (My XML-LibXML: 2.0125). Is this normal?

    ADDED: actually it is the second line which causes Perl to crash...as I do not have any TBXcoreStructV02.dtd, how can I jump this line? As the XML is huge, I do not want to manipulate it.

      Is this normal?

      Nope :-)

      As with choroba, even with the DTD, it works for me.

      as I do not have any TBXcoreStructV02.dtd, how can I jump this line? As the XML is huge, I do not want to manipulate it.

      Well, you could add load_ext_dtd=>0 to the XML::LibXML::Reader constructor, but that's really just a workaround, and I can't even say if it'll help fix your crashes. The better solutions would be to either obtain the right file(s), and fix the crashes overall, such as by trying to upgrade your libraries.

      BTW, since you just added that in a third edit to your node, please see How do I change/delete my post? to avoid confusion.

        Brilliant. Turning off the validation works for now.

        Sorry for my bad editing... today I am really under big pressure!

      I downloaded the DTD from ttt.org in order to run the script (with the data shown in my previous reply), but it still doesn't crash.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,