delete @{$self}{qw/last_status exit_code/};
$self->tool->start($self);
- $self->parser($self->tool->parser_class->new)->start($self);
+ $self->parser($self->tool->parser_class($self)->new)->start($self);
$self->action->start($self);
return;
sub new_trainer { }
+=head2 C<parser_class $session>
+
+Returns the class from which the parser for this tool output will be instanciated.
+
+This method must be implemented when subclassing.
+
+=cut
+
+sub parser_class;
+
=head2 C<report_class $session>
Returns the class in which suppression reports generated by this tool will be blessed.
sub suppressions_tag { 'memcheck-' . $_[1]->version }
+=head2 C<parser_class $session>
+
+This tool uses a C<Test::Valgrind::Parser::XML::Twig> parser in analysis mode, and a C<Test::Valgrind::Parser::Suppressions::Text> parser in suppressions mode.
+
+=cut
+
+sub parser_class {
+ my ($self, $session) = @_;
+
+ my $class = $session->do_suppressions
+ ? 'Test::Valgrind::Parser::Suppressions::Text'
+ : 'Test::Valgrind::Parser::XML::Twig';
+
+ local $@;
+ eval "require $class";
+
+ return $class;
+}
+
=head2 C<report_class $session>
This tool emits C<Test::Valgrind::Tool::memcheck::Report> object reports in analysis mode.