On Wed, Mar 4, 2009 at 5:29 PM, Zefram <[email protected]> wrote:
> For a proper fix, I reckon Module::Build needs to not dump the cached
> cbuilder to _build/build_params.  It should be dumping parameters, not
> a cache, or at least not a cache of complex objects.  I don't offhand
> see anything other than _cbuilder that's likely to cause trouble, but
> others will be able to figure this out better than I can.

Zefram, great job with the forensics.  Thank you.

How about this for a simple fix: rather than cache the CBuilder object
in properties, create a new "stash" for non-persistent caching.  It's
a simple patch and all tests still pass.

Unless I hear strong objections, I'll commit this to the trunk
tomorrow.  Unfortunately, that doesn't help Zefram deal with older
Module::Builds, but at least it fixes it going forward.

-- David

=== lib/Module/Build/Base.pm
==================================================================
--- lib/Module/Build/Base.pm    (revision 4515)
+++ lib/Module/Build/Base.pm    (local)
@@ -129,6 +129,7 @@
                                   %input,
                                  },
                    phash => {},
+                    stash => {}, # temporary caching, not stored in _build
                   }, $package;

   $self->_set_defaults;
@@ -4144,13 +4145,13 @@
   # Returns a CBuilder object

   my $self = shift;
-  my $p = $self->{properties};
-  return $p->{_cbuilder} if $p->{_cbuilder};
+  my $s = $self->{stash};
+  return $s->{_cbuilder} if $s->{_cbuilder};
   die "Module::Build is not configured with C_support"
          unless $self->_mb_feature('C_support');

   require ExtUtils::CBuilder;
-  return $p->{_cbuilder} = ExtUtils::CBuilder->new(
+  return $s->{_cbuilder} = ExtUtils::CBuilder->new(
     config => $self->config,
     ($self->quiet ? (quiet => 1 ) : ()),
   );

Reply via email to