X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FTest%2FValgrind%2FAction%2FSuppressions.pm;h=2ee894a15331e2287f186a545020cd770ccd1e23;hb=f2071d95aaaa4817e91cc33530deedc8d701d44d;hp=4d666a794121c15e6ba83f780b54577494f0add6;hpb=1b06adb9788085e8aad3af42ea384153cd0a4fe6;p=perl%2Fmodules%2FTest-Valgrind.git diff --git a/lib/Test/Valgrind/Action/Suppressions.pm b/lib/Test/Valgrind/Action/Suppressions.pm index 4d666a7..2ee894a 100644 --- a/lib/Test/Valgrind/Action/Suppressions.pm +++ b/lib/Test/Valgrind/Action/Suppressions.pm @@ -9,11 +9,11 @@ Test::Valgrind::Action::Suppressions - Generate suppressions for a given tool. =head1 VERSION -Version 1.02 +Version 1.19 =cut -our $VERSION = '1.02'; +our $VERSION = '1.19'; =head1 DESCRIPTION @@ -21,13 +21,19 @@ This action just writes the contents of the suppressions reports received into t =cut -use base qw/Test::Valgrind::Action Test::Valgrind::Action::Captor/; +use base qw; =head1 METHODS This class inherits L. -=head2 C<< new name => $name, target => $target, ... >> +=head2 C + + my $tvas = Test::Valgrind::Action::Suppressions->new( + name => $name, + target => $target, + %extra_args, + ); Your usual constructor. @@ -45,7 +51,7 @@ sub new { my %validated; - for (qw/name target/) { + for (qw) { my $arg = delete $args{$_}; $class->_croak("'$_' is expected to be a plain scalar") unless $arg and not ref $arg; @@ -54,7 +60,7 @@ sub new { my $self = $class->SUPER::new(%args); - $self->{$_} = $validated{$_} for qw/name target/; + $self->{$_} = $validated{$_} for qw; $self; } @@ -63,6 +69,8 @@ sub do_suppressions { 1 } =head2 C + my $name = $tvas->name; + Read-only accessor for the C option. =cut @@ -71,6 +79,8 @@ sub name { $_[0]->{name} } =head2 C + my $target = $tvas->target; + Read-only accessor for the C option. =cut @@ -82,7 +92,7 @@ sub start { $self->SUPER::start($sess); - delete @{$self}{qw/status supps diagnostics/}; + delete @{$self}{qw}; $self->save_fh(\*STDOUT => '>' => undef); $self->save_fh(\*STDERR => '>' => undef); @@ -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 Vincent Pit, all rights reserved. +Copyright 2009,2010,2011,2013,2015,2016 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.