Author: kwilliams
Date: Tue Oct 23 12:11:23 2007
New Revision: 10108
Added:
Module-Build/trunk/lib/Module/Build/Dumper.pm
Modified:
Module-Build/trunk/Changes
Module-Build/trunk/lib/Module/Build/Base.pm
Module-Build/trunk/lib/Module/Build/Notes.pm
Log:
More Data::Dumper fixes
Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes (original)
+++ Module-Build/trunk/Changes Tue Oct 23 12:11:23 2007
@@ -20,7 +20,7 @@
A. Berry]
- We now use a much more reliable method when Data::Dumper-ing saved
- state data to the _build/ directory. [Yves]
+ state data. [Yves]
- When a module had 0.000 as its version, a few places in the code
thought the module had no version at all. This is now
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Tue Oct 23 12:11:23 2007
@@ -10,7 +10,7 @@
use File::Basename ();
use File::Spec 0.82 ();
use File::Compare ();
-use Data::Dumper ();
+use Module::Build::Dumper ();
use IO::File ();
use Text::ParseWords ();
@@ -1042,9 +1042,7 @@
return;
}
- print $fh ("do{ my "
- . Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
- . '$x; }');
+ print {$fh} Module::Build::Dumper->_data_dump($data);
}
sub write_config {
Added: Module-Build/trunk/lib/Module/Build/Dumper.pm
==============================================================================
--- (empty file)
+++ Module-Build/trunk/lib/Module/Build/Dumper.pm Tue Oct 23 12:11:23 2007
@@ -0,0 +1,16 @@
+package Module::Build::Dumper;
+
+# This is just a split-out of a wrapper function to do Data::Dumper
+# stuff "the right way". See:
+#
http://groups.google.com/group/perl.module.build/browse_thread/thread/c8065052b2e0d741
+
+use Data::Dumper;
+
+sub _data_dump {
+ my ($self, $data) = @_;
+ return ("do{ my "
+ . Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
+ . '$x; }')
+}
+
+1;
Modified: Module-Build/trunk/lib/Module/Build/Notes.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Notes.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Notes.pm Tue Oct 23 12:11:23 2007
@@ -5,6 +5,7 @@
use strict;
use Data::Dumper;
use IO::File;
+use Module::Build::Dumper;
sub new {
my ($class, %args) = @_;
@@ -104,8 +105,7 @@
my ($self, $file, $data) = @_;
my $fh = IO::File->new("> $file") or die "Can't create '$file': $!";
- local $Data::Dumper::Terse = 1;
- print $fh Data::Dumper::Dumper($data);
+ print {$fh} Module::Build::Dumper->_data_dump($data);
}
sub write_config_data {
@@ -138,6 +138,9 @@
sub write {
my $me = __FILE__;
require IO::File;
+
+ # Can't use Module::Build::Dumper here because M::B is only a
+ # build-time prereq of this module
require Data::Dumper;
my $mode_orig = (stat $me)[2] & 07777;
@@ -149,9 +152,11 @@
}
die "Couldn't find __DATA__ token in $me" if eof($fh);
- local $Data::Dumper::Terse = 1;
seek($fh, tell($fh), 0);
- $fh->print( Data::Dumper::Dumper([$config, $features, $auto_features]) );
+ my $data = [$config, $features, $auto_features];
+ $fh->print( 'do{ my '
+ . Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
+ . '$x; }' );
truncate($fh, tell($fh));
$fh->close;
@@ -281,8 +286,7 @@
EOF
- local $Data::Dumper::Terse = 1;
- print $fh Data::Dumper::Dumper([$args{config_data}, $args{feature},
$args{auto_features}]);
+ print {$fh} Module::Build::Dumper->_data_dump([$args{config_data},
$args{feature}, $args{auto_features}]);
}
1;