BEGIN { XML::Twig->add_options('Stash'); }
my %handlers = (
- '/valgrindoutput/error' => \&handle_error,
+ '/valgrindoutput/protocolversion' => \&handle_version,
+ '/valgrindoutput/error' => \&handle_error,
);
sub new {
sub stash { shift->{Stash} }
+eval "sub $_ { \@_ <= 1 ? \$_[0]->{$_} : (\$_[0]->{$_} = \$_[1]) }"
+ for qw/_session protocol_version/;
+
# We must store the session in ourselves because it's only possible to pass
# arguments to XML::Twig objects by a global stash.
-sub _session { @_ <= 1 ? $_[0]->{_session} : ($_[0]->{_session} = $_[1]) }
-
sub start {
my ($self, $sess) = @_;
return;
}
+sub handle_version {
+ my ($twig, $node) = @_;
+
+ $twig->protocol_version($node->text);
+
+ $twig->purge;
+}
+
sub handle_error {
my ($twig, $node) = @_;