Skip to content
Browse files

Merge branch 'fix/RT76531-Dumper' of https://github.com/dolmen/p5-Dev…

  • Loading branch information...
2 parents 04ad3fe + e3adcf2 commit cfc015fb08e6a5672ad5c68b54c0f6535850a8b5 @pjcj committed Apr 14, 2012
View
3 Changes
@@ -1,11 +1,12 @@
Devel::Cover history
{{$NEXT}}
+ - Cleanup Data::Dumper usage (localize settings) (Olivier Mengué) (rt 76531)
Release 0.86 - 9th April 2012
- Add all coverage criteria to the Vim report.
-Release 0.85 - 1th April 2012
+Release 0.85 - 1st April 2012
- Add customisable thresholds to HTML reports (Xavier Caron).
- Improve Vim report.
View
3 bin/cover
@@ -22,8 +22,7 @@ use File::Find ();
use File::Path;
use Getopt::Long;
use Pod::Usage;
-
-use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1;
+use Data::Dumper (); # no import of Dumper (use Devel::Devel::Cover if needed)
my $Options =
{
View
3 bin/cpancover
@@ -15,15 +15,14 @@ use warnings;
# VERSION
use Devel::Cover::DB;
+use Devel::Cover::Dumper;
use Cwd ();
use Getopt::Long;
use Pod::Usage;
use Template 2.00;
use Parallel::Iterator "iterate_as_array";
-use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1;
-
# use Carp; $SIG{__DIE__} = \&Carp::confess;
my $Template;
View
2 lib/Devel/Cover.pm
@@ -29,7 +29,7 @@ use Config;
use Cwd "abs_path";
use File::Spec;
-use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1;
+use Devel::Cover::Dumper;
BEGIN
{
View
2 lib/Devel/Cover/DB.pm
@@ -20,7 +20,7 @@ use Devel::Cover::DB::IO;
use Carp;
use File::Path;
-use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1;
+use Devel::Cover::Dumper; # For debugging
my $DB = "cover.13"; # Version 13 of the database.
View
2 lib/Devel/Cover/DB/File.pm
@@ -14,7 +14,7 @@ use warnings;
use Devel::Cover::Criterion;
-use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1;
+use Devel::Cover::Dumper;
sub calculate_summary
{
View
3 lib/Devel/Cover/DB/Structure.pm
@@ -15,8 +15,7 @@ use Digest::MD5;
use Devel::Cover::DB;
use Devel::Cover::DB::IO;
-
-use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1;
+use Devel::Cover::Dumper;
# For comprehensive debug logging.
use constant DEBUG => 0;
View
36 lib/Devel/Cover/Dumper.pm
@@ -0,0 +1,36 @@
+# This file is part of Devel::Cover.
+
+# This software is free. It is licensed under the same terms as Perl itself.
+
+# The latest version of this software should be available from my homepage:
+# http://www.pjcj.net
+
+# Author of this file: Olivier Mengué
+
+package # Private module
+ Devel::Cover::Dumper;
+
+use strict qw<vars subs>; # no refs
+use warnings;
+
+sub import
+{
+ my $caller = caller;
+ if (defined &{"${caller}::Dumper"} && \&{"${caller}::Dumper"} != \&Dumper) {
+ require Carp;
+ Carp::croak("Data::Dumper previously imported. Use instead Devel::Cover::Dumper");
+ }
+ *{"${caller}::Dumper"} = \&Dumper;
+}
+
+sub Dumper
+{
+ require Data::Dumper;
+ local $Data::Dumper::Indent = 1;
+ local $Data::Dumper::Sortkeys = 1;
+ Data::Dumper::Dumper(@_);
+}
+
+1;
+__END__
+# vim:set et:
View
2 lib/Devel/Cover/Op.pm
@@ -14,7 +14,7 @@ use warnings;
# VERSION
-use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = 1;
+use Devel::Cover::Dumper;
use Devel::Cover qw( -ignore blib -ignore \\wB\\w );
use B::Concise qw( set_style add_callback );
View
2 lib/Devel/Cover/Report/Html_basic.pm
@@ -325,7 +325,7 @@ sub print_conditions
types => \@types,
};
- # use Data::Dumper; print Dumper \@types;
+ # use Devel::Cover::Dumper; print Dumper \@types;
my $html = "$R{options}{outputdir}/$R{filenames}{$R{file}}--condition.html";
$Template->process("conditions", $vars, $html) or die $Template->error();
View
2 lib/Devel/Cover/Report/Html_minimal.pm
@@ -214,7 +214,7 @@ sub _branch_report {
#-------------------------------------------------------------------------------
sub _condition_report {
my $coverage = shift;
- # use Data::Dumper; print STDERR Dumper $coverage;
+ # use Devel::Cover::Dumper; print STDERR Dumper $coverage;
my @tables = truth_table(@{$coverage->{condition}});
return unless @tables;
View
6 lib/Devel/Cover/Report/Sort.pm
@@ -19,19 +19,19 @@ sub print_sort
my ($db, $options) = @_;
my %runs;
my @collected = grep $_ ne "time", @{$options->{coverage}};
- # use Data::Dumper; print Dumper [$db->runs];
+ # use Devel::Cover::Dumper; print Dumper [$db->runs];
for my $r (sort {$a->{start} <=> $b->{start}} $db->runs)
{
print "Run: ", $r->run, "\n";
print "Perl version: ", $r->perl, "\n";
print "OS: ", $r->OS, "\n";
print "Start: ", scalar gmtime $r->start / 1e6, "\n";
print "Finish: ", scalar gmtime $r->finish / 1e6, "\n";
- # use Data::Dumper; print Dumper $r;
+ # use Devel::Cover::Dumper; print Dumper $r;
@{$runs{$r->run}}{"vec", "size"} = ("", 0);
my $run = $runs{$r->run};
- # use Data::Dumper; print Dumper $run;
+ # use Devel::Cover::Dumper; print Dumper $run;
my $vec = $r->vec;
for my $file (@{$options->{file}})
{
View
2 lib/Devel/Cover/Report/Text.pm
@@ -25,7 +25,7 @@ sub print_runs
print "Start: ", scalar gmtime $r->start / 1e6, "\n";
print "Finish: ", scalar gmtime $r->finish / 1e6, "\n";
print "\n";
- # use Data::Dumper; print Dumper $r;
+ # use Devel::Cover::Dumper; print Dumper $r;
}
}
View
4 lib/Devel/Cover/Test.pm
@@ -294,7 +294,7 @@ sub run_cover
}
};
- # use Data::Dumper; print STDERR "--->", Dumper $self->{changes};
+ # use Devel::Cover::Dumper; print STDERR "--->", Dumper $self->{changes};
open T, "$cover_com 2>&1 |" or die "Cannot run $cover_com: $!";
while (!eof T)
{
@@ -355,7 +355,7 @@ sub create_gold
unlink $new_gold;
}
- # use Data::Dumper; print STDERR Dumper $self;
+ # use Devel::Cover::Dumper; print STDERR Dumper $self;
if ($self->{skip})
{
print STDERR "Skipping: $self->{skip}\n";
View
2 lib/Devel/Cover/Truth_Table.pm
@@ -124,7 +124,7 @@ sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my @args = @_;
- # use Data::Dumper; print Dumper \@args;
+ # use Devel::Cover::Dumper; print Dumper \@args;
return bless {
inputs => $args[0],
result => $args[1],

0 comments on commit cfc015f

Please sign in to comment.
Something went wrong with that request. Please try again.