=head1 VERSION
-Version 1.02
+Version 1.11
=cut
-our $VERSION = '1.02';
+our $VERSION = '1.11';
=head1 DESCRIPTION
=cut
-use base qw/Test::Valgrind::Carp/;
+use base qw/Test::Valgrind::Component Test::Valgrind::Carp/;
=head1 METHODS
return $tool->new(%args);
}
- my $self = bless { }, $class;
-
- $self->started(undef);
-
- $self;
+ $class->SUPER::new(@_);
}
=head2 C<new_trainer>
sub new_trainer { }
-=head2 C<report_class $session>
-
-Wraps around either L</report_class_suppressions> or L</report_class_analysis> depending on the running mode of the C<$session>.
-
-=cut
-
-sub report_class {
- my ($self, $sess) = @_;
-
- if ($sess->do_suppressions) {
- $self->report_class_suppressions($sess);
- } else {
- $self->report_class_analysis($sess);
- }
-}
-
-=head2 C<report_class_suppressions $session>
+=head2 C<parser_class $session>
-Returns the class in which suppression reports generated by this tool will be blessed.
+Returns the class from which the parser for this tool output will be instanciated.
This method must be implemented when subclassing.
=cut
-sub report_class_suppression;
+sub parser_class;
-=head2 C<report_class_analysis $session>
+=head2 C<report_class $session>
-Returns the class in which error reports generated by this tool will be blessed.
+Returns the class in which suppression reports generated by this tool will be blessed.
This method must be implemented when subclassing.
=cut
-sub report_class_analysis;
+sub report_class;
=head2 C<args $session>
sub suppressions_tag;
-=head2 C<started>
-
-Specifies whether the tool is running (C<1>), stopped (C<0>) or was never started (C<undef>).
-
-=cut
-
-sub started { @_ <= 1 ? $_[0]->{started} : ($_[0]->{started} = $_[1]) }
-
=head2 C<start $session>
Called when the C<$session> starts.
-Defaults to set L</started>.
-
-=cut
-
-sub start {
- my ($self) = @_;
-
- $self->_croak('Tool already started') if $self->started;
- $self->started(1);
-
- return;
-}
-
-=head2 C<parse $session, $fh>
-
-Wraps around either L</parse_suppressions> or L</parse_analysis> depending on the running mode of the C<$session>.
-Croaks if the tool isn't started.
-
-=cut
-
-sub parse {
- my ($self, $sess, $fh) = @_;
-
- $self->_croak('Tool isn\'t started') unless $self->started;
-
- if ($sess->do_suppressions) {
- $self->parse_suppressions($sess, $fh);
- } else {
- $self->parse_analysis($sess, $fh);
- }
-}
-
-=head2 C<parse_suppressions $sesssion, $fh>
-
-Parse the suppression reports that the C<valgrind> process attached to the session C<$session> send through the filehandle C<$fh>.
+Defaults to set L<Test::Valgrind::Component/started>.
-This method must be implemented when subclassing.
-
-=cut
+=head2 C<filter $session, $report>
-sub parse_suppressions;
+The C<$session> calls this method after receiving a report from the parser and before letting the command filter it.
+You can either return a mangled C<$report> (which does not need to be a clone of the original) or C<undef> if you want the action to ignore it completely.
-=head2 C<parse_analysis $sesssion, $fh>
-
-Parse the error reports sent by the C<valgrind> process attached to the session C<$session> through the filehandle C<$fh>.
-
-This method must be implemented when subclassing.
+Defaults to the identity function.
=cut
-sub parse_analysis;
+sub filter { $_[2] }
=head2 C<finish $session>
Called when the C<$session> finishes.
-Defaults to clear L</started>.
-
-=cut
-
-sub finish {
- my ($self) = @_;
-
- return unless $self->started;
- $self->started(0);
-
- return;
-}
+Defaults to clear L<Test::Valgrind::Component/started>.
=head1 SEE ALSO
-L<Test::Valgrind>, L<Test::Valgrind::Session>.
+L<Test::Valgrind>, L<Test::Valgrind::Component>, L<Test::Valgrind::Session>.
=head1 AUTHOR