Subject: | [PATCH] Using subclass() from a MB subclass |
[NOTE: This bug is actually against 0.2610, but rt.cpan.org doesn't know about that version yet, so I filed against 0.2609. I also checked 0.27_01]
I have a Module::Build subclass that handles building Flash projects, called Module::Build::Flash (not yet released). One of my Flash projects needs special treatment, so my Build.PL uses subclass() like so:
use Module::Build::Flash;
my $class = Module::Build::Flash->subclass( code => <<'EOC' );
... some method overriding here ...
EOC
$class->new(dist_name => 'Foo',
dist_version => '1.00',
)->create_build_script;
This fails because the subclass that is created in _build/lib/MyModuleBuilder.pm has "Module::Build" hard coded in it instead of "Module::Build::Flash". So, the Flash-specific functionality is lost in the subclass() output.
The tiny attached patch permits Module::Build subclasses to use the subclass() method by un-hardcoding the reference to Module::Build. The patch is against 0.2610 but should work fine against 0.27_01.
--- Base.pm.orig 2005-04-19 14:17:04.000000000 -0500
+++ Base.pm 2005-04-19 14:17:34.000000000 -0500
@@ -509,8 +509,8 @@
my $fh = IO::File->new("> $filename") or die "Can't create $filename: $!";
print $fh <<EOF;
package $opts{class};
-use Module::Build;
-\@ISA = qw(Module::Build);
+use $pack;
+\@ISA = qw($pack);
$opts{code}
1;
EOF