| 1 |
#line 1 |
| 2 |
package Module::Install::MakeMaker; |
| 3 |
|
| 4 |
use strict; |
| 5 |
use ExtUtils::MakeMaker (); |
| 6 |
use Module::Install::Base (); |
| 7 |
|
| 8 |
use vars qw{$VERSION @ISA $ISCORE}; |
| 9 |
BEGIN { |
| 10 |
$VERSION = '1.21'; |
| 11 |
@ISA = 'Module::Install::Base'; |
| 12 |
$ISCORE = 1; |
| 13 |
} |
| 14 |
|
| 15 |
my $makefile = undef; |
| 16 |
|
| 17 |
sub WriteMakefile { |
| 18 |
my ($self, %args) = @_; |
| 19 |
$makefile = $self->load('Makefile'); |
| 20 |
|
| 21 |
# mapping between MakeMaker and META.yml keys |
| 22 |
$args{MODULE_NAME} = $args{NAME}; |
| 23 |
unless ( $args{NAME} = $args{DISTNAME} or ! $args{MODULE_NAME} ) { |
| 24 |
$args{NAME} = $args{MODULE_NAME}; |
| 25 |
$args{NAME} =~ s/::/-/g; |
| 26 |
} |
| 27 |
|
| 28 |
foreach my $key ( qw{name module_name version version_from abstract author installdirs} ) { |
| 29 |
my $value = delete($args{uc($key)}) or next; |
| 30 |
$self->$key($value); |
| 31 |
} |
| 32 |
|
| 33 |
if (my $prereq = delete($args{PREREQ_PM})) { |
| 34 |
while (my($k,$v) = each %$prereq) { |
| 35 |
$self->requires($k,$v); |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
if (my $prereq = delete($args{BUILD_REQUIRES})) { |
| 40 |
while (my($k,$v) = each %$prereq) { |
| 41 |
$self->build_requires($k,$v); |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
# put the remaining args to makemaker_args |
| 46 |
$self->makemaker_args(%args); |
| 47 |
} |
| 48 |
|
| 49 |
END { |
| 50 |
if ( $makefile ) { |
| 51 |
$makefile->write; |
| 52 |
$makefile->Meta->write; |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
1; |