I'm using following code to parse rather large xml file (> 50GB):
use XML::Parser;
my $p = new XML::Parser(
'Handlers' => {
'Start' => \&handle_start,
'End' => \&handle_end,
'Char' => \&handle_char,
}
);
$p->parsefile( 'source.xml' );
...
sub handle_start {
...
}
The problem is that it takes very long to parse, and I'd like to get some kind of progress meter.
I'd prefer a way that doesn't require first scanning whole file just to get total count - so, for example, current position in input file would be perfect, because I could simply check at start total size of file, and then in handle_start() check current position, and print it.