Re: Module::Starter released

2004-04-06 Thread Randy W. Sims
Andy Lester wrote:
I've just released Module::Starter 0.02, meant as a replacement for h2xs.
I just reinstalled Debian on my laptop with the default perl (5.6.1). 
The following are the modules required and requested for 
Module::Starter and its dependents. Not complaining or making any 
judgement, just thought it interesting.

Archive-Tar-1.08
Devel-CoreStack-1.3
Devel-Symdump-2.03
ExtUtils-CBuilder-0.02
ExtUtils-ParseXS-2.08
Module-Build-0.24
Pod-Coverage-0.13
Pod-Escapes-1.03
Pod-Simple-2.05
Test-Builder-Tester-0.09
Test-Harness-2.40
Test-Pod-1.12
Test-Pod-Coverage-0.08
Test-Simple-0.47
YAML-0.35


Module::Starter released

2004-04-05 Thread Andy Lester
I've just released Module::Starter 0.02, meant as a replacement for h2xs.

I think h2xs is very out of date as far as current best practices for
modules.  It's also very intimidating for people who just want to create
a module, and have no need for all the compiler hoohah that h2xs throws
at you.  Module::Starter is meant to make things much eaiser.

Here's a sample run of Module::Starter's command-line program:

$ module-starter --module=Foo,Foo::Bar,Foo::Bat \
[EMAIL PROTECTED] --author=Andy Lester

$ find Foo
Foo
Foo/.cvsignore
Foo/Changes
Foo/lib
Foo/lib/Foo
Foo/lib/Foo/Bar.pm
Foo/lib/Foo/Bat.pm
Foo/lib/Foo.pm
Foo/Makefile.PL
Foo/MANIFEST
Foo/t
Foo/t/00.load.t
Foo/t/pod-coverage.t
Foo/t/pod.t

$ cat Foo/Makefile.PL 
use strict;
use warnings;
use ExtUtils::MakeMaker;

WriteMakefile(
NAME= 'Foo',
AUTHOR  = 'Andy Lester [EMAIL PROTECTED]',
VERSION_FROM= 'lib/Foo.pm',
ABSTRACT_FROM   = 'lib/Foo.pm',
PREREQ_PM = {
'Test::More' = 0,
},
dist= { COMPRESS = 'gzip -9f', SUFFIX = 'gz', },
clean   = { FILES = 'Foo-*' },
);

Comments are welcome, and expected.

xoa

-- 
Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance


Re: Module::Starter released

2004-04-05 Thread Mark Stosberg
On Mon, Apr 05, 2004 at 02:15:30PM -0500, Andy Lester wrote:
 I've just released Module::Starter 0.02, meant as a replacement for h2xs.
 
 I think h2xs is very out of date as far as current best practices for
 modules.  It's also very intimidating for people who just want to create
 a module, and have no need for all the compiler hoohah that h2xs throws
 at you.  Module::Starter is meant to make things much eaiser.
 
 Here's a sample run of Module::Starter's command-line program:

Thanks Andy.

Here's an initial comment:
I think would useful to include ExtUtils::ModuleMaker in a SEE ALSO
section, and explain the key differences. At first glance the projects
seem quite similar.

Mark

--
 . . . . . . . . . . . . . . . . . . . . . . . . . . . 
   Mark StosbergPrincipal Developer  
   [EMAIL PROTECTED] Summersault, LLC 
   765-939-9301 ext 202 database driven websites
 . . . . . http://www.summersault.com/ . . . . . . . .


Re: Module::Starter released

2004-04-05 Thread Randy W. Sims
Andy Lester wrote:
I've just released Module::Starter 0.02, meant as a replacement for h2xs.
I just reinstalled Debian on my laptop with the default perl (5.6.1). 
The following are the modules required and requested for 
Module::Starter and its dependents. Not complaining or making any 
judgement, just thought it interesting.

Archive-Tar-1.08
Devel-CoreStack-1.3
Devel-Symdump-2.03
ExtUtils-CBuilder-0.02
ExtUtils-ParseXS-2.08
Module-Build-0.24
Pod-Coverage-0.13
Pod-Escapes-1.03
Pod-Simple-2.05
Test-Builder-Tester-0.09
Test-Harness-2.40
Test-Pod-1.12
Test-Pod-Coverage-0.08
Test-Simple-0.47
YAML-0.35


Re: Module::Starter released

2004-04-05 Thread Randy W. Sims
Andy Lester wrote:
I've just released Module::Starter 0.02, meant as a replacement for h2xs.

I think h2xs is very out of date as far as current best practices for
modules.  It's also very intimidating for people who just want to create
a module, and have no need for all the compiler hoohah that h2xs throws
at you.  Module::Starter is meant to make things much eaiser.
Attached is a patch with preliminary support for Module::Build support. 
I added a 'builder' option for specifing whether to use M::B or 
MakeMaker; default is still MakeMaker. I also added a 'license' option 
as M::B likes to have it and the next version of MakeMaker will also 
support it (for META.yml) although it is not in the current snapshot.

One thing that may be desirable is to add options for Build.PL and 
Makefile.PL to co-exist, using one of Module::Build's compatability modes.

Another addition would be to allow module-starter to write a module for 
an already created project. For example, if you create a project 
'module-starter --module='Foo::Bar'', and later, you decide you need 
another module to add to the existing project. 'module-starter 
--module-only --module='Foo::Bar::Baz''.

Randy.
diff -urN Module-Starter-0.02-orig/Starter.pm Module-Starter-0.02/Starter.pm
--- Module-Starter-0.02-orig/Starter.pm Sun Apr  4 23:32:12 2004
+++ Module-Starter-0.02/Starter.pm  Mon Apr  5 19:44:32 2004
@@ -45,12 +45,15 @@
 
 =item * $email
 
+=item * $license
+
 =back
 
 =cut
 
 our $verbose = 0;
 our $force = 0;
+our $license = undef;
 our $author = Module Author;
 our $email = [EMAIL PROTECTED];
 
@@ -63,6 +66,7 @@
 dir = $dirname,
 modules = [ module names ],
 distro = $distroname,
+builder = 'Module::Build', # Defaults to ExtUtils::MakeMaker
 
 =cut
 
@@ -78,6 +82,10 @@
 die Must specify an author\n unless $author;
 die Must specify an email address\n unless $email;
 
+unless ( defined($license) ) {
+warn Defaulting to 'perl' license type\n;
+$license = 'perl';
+}
 
 my $distro = $args{distro};
 if ( not defined $distro ) {
@@ -93,7 +101,13 @@
 
 push @files, create_t( $basedir, @modules );
 push @files, create_cvsignore( $basedir, $distro );
-push @files, create_Makefile_PL( $basedir, $distro, $modules[0] );
+
+if ( $args{builder} eq 'Module::Build' ) {
+push @files, create_Build_PL( $basedir, $distro, $modules[0] );
+} else {
+push @files, create_Makefile_PL( $basedir, $distro, $modules[0] );
+}
+
 push @files, create_Changes( $basedir, $distro );
 push @files, MANIFEST;
 push @files, 'META.yml # Will be created by make dist';
@@ -172,7 +186,7 @@
 my $module_file = File::Spec-catfile( @dirparts,  $filepart );
 
 open( my $fh, , $module_file ) or die Can't create $module_file: $!\n;
-print $fh _module_guts( $module );
+print $fh _module_guts( $module );
 close $fh;
 print Created $module_file\n if $verbose;
 
@@ -301,6 +315,49 @@
 print Created $fname\n if $verbose;
 
 return Makefile.PL;
+}
+
+=head2 create_Build_PL( $basedir, $distro, $main_module )
+
+Creates a Build.PL for the given module distro.
+
+=cut
+
+sub create_Build_PL {
+my $basedir = shift;
+my $distro = 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 );
+
+my $fname = File::Spec-catfile( $basedir, Build.PL );
+open( my $fh, , $fname ) or die Can't create $fname: $!\n;
+
+print $fh HERE;
+use strict;
+use warnings;
+use Module::Build;
+
+my \$builder = Module::Build-new(
+module_name = '$main_module',
+license = '$license',
+dist_author = '$author $email',
+dist_version_from   = '$main_pm_file',
+requires = {
+'Test::More' = 0,
+},
+add_to_cleanup  = [ '$distro-*' ],
+);
+
+\$builder-create_build_script();
+HERE
+
+close $fh;
+print Created $fname\n if $verbose;
+
+return Build.PL;
 }
 
 =head2 create_Changes( $basedir, $distro )
diff -urN Module-Starter-0.02-orig/bin/module-starter 
Module-Starter-0.02/bin/module-starter
--- Module-Starter-0.02-orig/bin/module-starter Sun Apr  4 23:17:02 2004
+++ Module-Starter-0.02/bin/module-starter  Mon Apr  5 19:41:07 2004
@@ -15,21 +15,29 @@
 my $distro;
 my $dir;
 
+my $builder = 'ExtUtils::MakeMaker';
+
 GetOptions(
 distro=s =   \$distro,
 module=s =   [EMAIL PROTECTED],
+builder=s =  \$builder,
 
 author=s =   \$Module::Starter::author,
 email=s =\$Module::Starter::email,
+license=s =  \$Module::Starter::license,
 force =\$Module::Starter::force,
 verbose =  \$Module::Starter::verbose,
 version =  sub { print module-starter v$Module::Starter::VERSION\n; exit 
1; },
 help = sub { pod2usage(1); },
 ) or pod2usage(2); 
 
+pod2usage(2) unless ( $builder eq 'ExtUtils::MakeMaker' ||
+ 

Re: Module::Starter released

2004-04-05 Thread Ken Williams
On Apr 5, 2004, at 3:18 PM, Mark Stosberg wrote:

I think would useful to include ExtUtils::ModuleMaker in a SEE ALSO
section, and explain the key differences. At first glance the projects
seem quite similar.
Yeah, I actually wonder whether the two projects could be merged 
somehow.  Is Geoffrey responsive to emails about EU::ModuleMaker?

 -Ken