in reply to XML::LibXML::Reader get size

Just count the occurrences in a loop:
my $count = 0; ++$count while $reader->nextPatternMatch($entry_pattern);

The problem is that once the loop is finished, you're at the end of the document, so you have to reinstantiate the reader object.

($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,

Replies are listed 'Best First'.
Re^2: XML::LibXML::Reader get size
by Anonymous Monk on Apr 27, 2018 at 17:09 UTC

    Second problem is that if the XML is very big this will make the process last much longer.

Re^2: XML::LibXML::Reader get size
by Anonymous Monk on Apr 27, 2018 at 13:08 UTC
    And since you are using the pull-parser, you'll be going through quite a bit of work just to arrive at a count, then doing it all over again. Might there be some kind of recognizable keyword within the file that you could find using regular-expressions? Read the file a chunk at a time, count the number of occurrences in each chunk, add 'em up and pretend that this is your count even if it isn't exactly. Or, perhaps just as well and a great deal easier, give the user some other sign of "visible progress," such as printing a "." to the console after every some-n nodes have been processed.