< Subs Style >

For the Subs style, when a start-tag is found, it calls the subroutine of the same name. Likewise, when an end-tag is found, it calls the subroutine of the same name plus an underscore.


use strict;
use XML::Parser;

my $parser = new XML::Parser(Style => 'Subs');
my $file = shift;
$parser->parsefile($file);
print "$file is well-formed.\n";

sub xml { }
sub xml_ { }
sub foo { }
sub foo_ { }
sub bar { }
sub bar_ { }