in reply to How to tell XML::Parser to stop?
There doesn't appear to be any express support within XML::Parser for interrupting the parse. I would suggest you consider employing an exception to stop the parse. Consider the following code. Also think about using the Exception::Class to further clarify that the parse is being interrupted for valid reasons instead of depending on a text message in the $@ variable.
eval { $p->parse( ... ) }; if ($@ =~ /^Interrupted parsing/) { # The parse was stopped early. } sub whatever_handler { if ( $found_record ) { die "Interrupted parsing"; } }
|
|---|