]> git.vpit.fr Git - perl/modules/Test-Valgrind.git/blobdiff - lib/Test/Valgrind/Action/Suppressions.pm
This is 1.17
[perl/modules/Test-Valgrind.git] / lib / Test / Valgrind / Action / Suppressions.pm
index 8a801ecbf55f2860f6fca496db562ee387a7a2d0..9002afc2514fcc2fe0667db0533cc8358d501a96 100644 (file)
@@ -9,11 +9,11 @@ Test::Valgrind::Action::Suppressions - Generate suppressions for a given tool.
 
 =head1 VERSION
 
-Version 1.12
+Version 1.17
 
 =cut
 
-our $VERSION = '1.12';
+our $VERSION = '1.17';
 
 =head1 DESCRIPTION
 
@@ -27,7 +27,13 @@ use base qw<Test::Valgrind::Action Test::Valgrind::Action::Captor>;
 
 This class inherits L<Test::Valgrind::Action>.
 
-=head2 C<< new name => $name, target => $target, ... >>
+=head2 C<new>
+
+    my $tvas = Test::Valgrind::Action::Suppressions->new(
+     name   => $name,
+     target => $target,
+     %extra_args,
+    );
 
 Your usual constructor.
 
@@ -63,6 +69,8 @@ sub do_suppressions { 1 }
 
 =head2 C<name>
 
+    my $name = $tvas->name;
+
 Read-only accessor for the C<name> option.
 
 =cut
@@ -71,6 +79,8 @@ sub name   { $_[0]->{name} }
 
 =head2 C<target>
 
+    my $target = $tvas->target;
+
 Read-only accessor for the C<target> option.
 
 =cut
@@ -135,17 +145,18 @@ sub finish {
  require File::Spec;
  my ($vol, $dir, $file) = File::Spec->splitpath($target);
  my $base = File::Spec->catpath($vol, $dir, '');
- unless (-e $base) {
+ if (-e $base) {
+  1 while unlink $target;
+ } else {
   require File::Path;
   File::Path::mkpath([ $base ]);
- } else {
-  1 while unlink $target;
  }
 
  open my $fh, '>', $target
                         or $self->_croak("open(\$fh, '>', \$self->target): $!");
 
- my (%seen, $id);
+ my $id = 0;
+ my %seen;
  for (sort { $a->data cmp $b->data }
        grep !$seen{$_->data}++, @{$self->{supps}}) {
   print $fh "{\n"
@@ -188,7 +199,7 @@ You can find documentation for this module with the perldoc command.
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2009,2010 Vincent Pit, all rights reserved.
+Copyright 2009,2010,2011,2013,2015 Vincent Pit, all rights reserved.
 
 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.