Test::Valgrind::Action - Base class for Test::Valgrind actions.


Test-Valgrind documentation Contained in the Test-Valgrind distribution.

Index


Code Index:

NAME

Top

Test::Valgrind::Action - Base class for Test::Valgrind actions.

VERSION

Top

Version 1.12

DESCRIPTION

Top

This class is the base for Test::Valgrind actions.

Actions are called each time a tool encounter an error and decide what to do with it (for example passing or failing tests).

METHODS

Top

new action => $action

Creates a new action object of type $action by requiring and redispatching the method call to the module named $action if it contains '::' or to Test::Valgrind::Action::$action otherwise. The class represented by $action must inherit this class.

do_suppressions

Indicates if the action wants valgrind to run in suppression-generating mode or in analysis mode.

start $session

Called when the $session starts.

Defaults to set started in Test::Valgrind::Component.

report $session, $report

Invoked each time the valgrind process attached to the $session spots an error. $report is a Test::Valgrind::Report object describing the error.

Defaults to check started in Test::Valgrind::Component.

abort $session, $msg

Triggered when the $session has to interrupt the action.

Defaults to croak.

finish $session

Called when the $session finishes.

Defaults to clear started in Test::Valgrind::Component.

status $session

Returns the status code corresponding to the last run of the action.

SEE ALSO

Top

Test::Valgrind, Test::Valgrind::Component, Test::Valgrind::Session.

AUTHOR

Top

Vincent Pit, <perl at profvince.com>, http://www.profvince.com.

You can contact me by mail or on irc.perl.org (vincent).

BUGS

Top

Please report any bugs or feature requests to bug-test-valgrind at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Valgrind. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Test::Valgrind::Action

COPYRIGHT & LICENSE

Top


Test-Valgrind documentation Contained in the Test-Valgrind distribution.
package Test::Valgrind::Action;

use strict;
use warnings;

our $VERSION = '1.12';

use base qw/Test::Valgrind::Component Test::Valgrind::Carp/;

sub new {
 my $class = shift;
 $class = ref($class) || $class;

 my %args = @_;

 if ($class eq __PACKAGE__) {
  my $action = delete $args{action} || 'Test';
  $action =~ s/[^\w:]//g;
  $action = __PACKAGE__ . "::$action" if $action !~ /::/;
  $class->_croak("Couldn't load action $action: $@")
                                               unless eval "require $action; 1";
  return $action->new(%args);
 }

 $class->SUPER::new(@_);
}

sub do_suppressions { 0 }

sub report {
 my ($self) = @_;

 $self->_croak('Action isn\'t started') unless $self->started;

 return;
}

sub abort { $_[0]->_croak($_[2]) }

sub status {
 my ($self, $sess) = @_;

 my $started = $self->started;

 $self->_croak("Action was never started") unless defined $started;
 $self->_croak("Action is still running")  if $started;

 return;
}

1; # End of Test::Valgrind::Action