Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Module-Starter CPAN distribution.

Report information
The Basics
Id: 22561
Status: resolved
Priority: 0/
Queue: Module-Starter

People
Owner: Nobody in particular
Requestors: mramberg [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Module::Install support
here's the patch I sent you earlier
Subject: Module-Starter-MI_Support.patch
diff -Naur Module-Starter-1.42/Changes Module-Starter/Changes --- Module-Starter-1.42/Changes 2005-11-09 18:25:14.000000000 +0100 +++ Module-Starter/Changes 2006-07-31 14:45:07.000000000 +0200 @@ -1,5 +1,7 @@ Revision history for Perl extension Module::Starter + * Add support for Module::Install + 1.42 Wed Nov 9 11:25:10 CST 2005 [FIXES] * Don't build Build.PL or Makefile.PL multiple times diff -Naur Module-Starter-1.42/bin/module-starter Module-Starter/bin/module-starter --- Module-Starter-1.42/bin/module-starter 2005-08-20 05:59:40.000000000 +0200 +++ Module-Starter/bin/module-starter 2006-07-26 09:43:03.000000000 +0200 @@ -47,6 +47,7 @@ "builder=s" => ($config{builder} ||= []), eumm => sub { push @{$config{builder}}, "ExtUtils::MakeMaker" }, mb => sub { push @{$config{builder}}, "Module::Build" }, + mi => sub { push @{$config{builder}}, "Module::Install" }, "author=s" => \$config{author}, "email=s" => \$config{email}, @@ -83,6 +84,7 @@ --builder=module Build with 'ExtUtils::MakeMaker' or 'Module::Build' --eumm Same as --build=ExtUtils::MakeMaker --mb Same as --build=Module::Build + --mi Same as --build=Module::Install --author=name Author's name (required) --email=email Author's email (required) diff -Naur Module-Starter-1.42/lib/Module/Starter/Simple.pm Module-Starter/lib/Module/Starter/Simple.pm --- Module-Starter-1.42/lib/Module/Starter/Simple.pm 2005-11-09 18:23:49.000000000 +0100 +++ Module-Starter/lib/Module/Starter/Simple.pm 2006-07-26 09:47:20.000000000 +0200 @@ -100,6 +100,15 @@ ./Build install HERE } + elsif ( $builder eq 'Module::Install' ) { + push @files, $self->create_MI_Makefile_PL( $self->{main_module} ); + push @build_instructions, <<'HERE'; + perl Makefile.PL + make + make test + make install +HERE + } else { push @files, $self->create_Makefile_PL( $self->{main_module} ); push @build_instructions, <<'HERE'; @@ -394,6 +403,34 @@ return "Makefile.PL"; } +=head2 create_MI_Makefile_PL( $main_module ) + +This will create a Module::Install Makefile.PL for the distribution, and will use +the module named in I<$main_module> as the main module of the distribution. + +=cut + +sub create_MI_Makefile_PL { + my $self = shift; + my $main_module = shift; + + my @parts = split( /::/, $main_module ); + my $pm = pop @parts; + my $main_pm_file = File::Spec->catfile( "lib", @parts, "${pm}.pm" ); + $main_pm_file =~ s{\\}{/}g; # even on Win32, use forward slash + + my $fname = File::Spec->catfile( $self->{basedir}, "Makefile.PL" ); + open( my $fh, ">", $fname ) or die "Can't create $fname: $!\n"; + + print $fh $self->MI_Makefile_PL_guts($main_module, $main_pm_file); + + close $fh; + $self->progress( "Created $fname" ); + + return "Makefile.PL"; +} + + =head2 Makefile_PL_guts( $main_module, $main_pm_file ) This method is called by create_Makefile_PL and returns text used to populate @@ -430,6 +467,39 @@ } +=head2 MI_Makefile_PL_guts( $main_module, $main_pm_file ) + +This method is called by create_MI_Makefile_PL and returns text used to populate +Makefile.PL; I<$main_pm_file> is the filename of the distribution's main +module, I<$main_module>. + +=cut + +sub MI_Makefile_PL_guts { + my $self = shift; + my $main_module = shift; + my $module_name = $main_module; + $module_name =~ s/::/-/g; + my $main_pm_file = shift; + + (my $author = "$self->{author} <$self->{email}>") =~ s/'/\'/g; + + return <<"HERE"; +use inc::Module::Install; + +name '$module_name'; +all_from '$main_pm_file'; + +build_requires 'Test::More'; + +auto_install; + +WriteAll; + +HERE + +} + =head2 create_Build_PL( $main_module ) This will create the Build.PL for the distribution, and will use the module
Applied in svn. -- rjbs
released -- rjbs