From: Vincent Pit Date: Sat, 2 May 2009 10:21:27 +0000 (+0200) Subject: Let the command filter reports X-Git-Tag: v1.02~5 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FTest-Valgrind.git;a=commitdiff_plain;h=a1b4baae74607fbdf8b8ea4d0a09c6220b3ca4ae Let the command filter reports --- diff --git a/lib/Test/Valgrind/Command.pm b/lib/Test/Valgrind/Command.pm index eb5a347..61f72fc 100644 --- a/lib/Test/Valgrind/Command.pm +++ b/lib/Test/Valgrind/Command.pm @@ -98,6 +98,17 @@ This method must be implemented when subclassing. sub suppressions_tag; +=head2 C + +The <$session> calls this method after receiving a report from the tool and before forwarding it to the action. +You can either return a mangled C<$report> (which does not need to be a clone of the original) or C if you want the action to ignore it completely. + +Defaults to the identity function. + +=cut + +sub filter { $_[2] } + =head1 SEE ALSO L, L. diff --git a/lib/Test/Valgrind/Session.pm b/lib/Test/Valgrind/Session.pm index 3174bde..1e8857e 100644 --- a/lib/Test/Valgrind/Session.pm +++ b/lib/Test/Valgrind/Session.pm @@ -412,8 +412,14 @@ Forwards to C<< ->action->report >> after unshifting the session object to the a =cut sub report { - my $self = shift; - $self->action->report($self, @_); + my ($self, $report) = @_; + + return unless defined $report; + + $report = $self->command->filter($self, $report); + return unless defined $report; + + $self->action->report($self, $report); } =head2 C