]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Tool.pm
Factor the start/finish logic into a new Test::Valgrind::Component base class
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Tool.pm
index a1211af7fb3a3dedaf668ca290980d677cfa15db..a82b95d676632a0f65c0e6d632375908b6ab3105 100644 (file)
@@ -24,7 +24,7 @@ They are expected to function both in suppressions generation and in analysis mo
 
 =cut
 
-use base qw/Test::Valgrind::Carp/;
+use base qw/Test::Valgrind::Component Test::Valgrind::Carp/;
 
 =head1 METHODS
 
@@ -58,11 +58,7 @@ sub new {
   return $tool->new(%args);
  }
 
- my $self = bless { }, $class;
-
- $self->started(undef);
-
- $self;
+ $class->SUPER::new(@_);
 }
 
 =head2 C<new_trainer>
@@ -132,30 +128,11 @@ This method must be implemented when subclassing.
 
 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;
-}
+Defaults to set L<Test::Valgrind::Component/started>.
 
 =head2 C<parse $session, $fh>
 
@@ -200,22 +177,11 @@ sub parse_analysis;
 
 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