Permalink
Browse files

Add module Devel::Cover::Dumper

This new module is a wrapper for Data::Dumper that uses the right flags,
locally (to avoid impact on other modules).
  • Loading branch information...
dolmen committed Apr 13, 2012
1 parent a1bb2d4 commit b587ba836bc9d9705d027f9947fb119b58e3bddd
Showing with 36 additions and 0 deletions.
  1. +36 −0 lib/Devel/Cover/Dumper.pm
View
@@ -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:

0 comments on commit b587ba8

Please sign in to comment.