Subject: | Build.PL to propogate version logic to Makefile, and extra requirements |
Attached patch does 2 things to Build.PL
Ensure the Makefile.PL has the perl-version-logic for Encode / Encode::compat
see http://www.kasei.com/pipermail/plucene/2005-April/000372.html
Adds a requirement for perl 5.6
"/ is not implemented in Perls before 5.6"
http://www.perldoc.com/perl5.8.4/pod/perlpacktut.html#Template-Grouping
And ads a build requirement for Text::Balanced
(which is included by default on perl 5.8 but not perl 5.6.1)
12c12,30
< Module::Build->new(
---
> # Kludge to ensure the Encode/Encode::compat logic is propogated
> # to the Makefile.PL. Thanks to Ken Williams for the tip.
> my $code = <<'EOF';
> use IO::Scalar;
> use IO::File;
> sub do_create_makefile_pl {
> my $self = shift;
> my $content = "";
> my $fake_fh = IO::Scalar->new(\$content);
> $self->SUPER::do_create_makefile_pl(fh => $fake_fh);
> $content =~ s/'Encode.*/\$] < 5.007001 ? ('Encode::compat' => '0.05a') : ('Encode' => ''),/m ;
> my $fh = IO::File->new(">Makefile.PL") or die $!;
> print $fh $content;
> }
> EOF
>
> my $class = Module::Build->subclass(code => $code);
>
> my $build = $class->new(
16a35
> 'perl' => '5.6',
35a55
> 'Text::Balanced' => '',
37c57,58
< )->create_build_script;
---
> );
> $build->create_build_script;