#!/usr/bin/perl -w

=head1 NAME

module-starter - Creates a skeleton module distribution

=cut

use strict;
use Module::Starter;
use Getopt::Long;
use Pod::Usage;

my @modules;
my $distro;
my $dir;
my @builders;

GetOptions(
    "distro=s" =>   \$distro,
    "module=s" =>   \@modules,
    "builder=s" =>  \@builders,
    eumm =>         sub { push @builders, "ExtUtils::MakeMaker" },
    mb =>           sub { push @builders, "Module::Build" },

    "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);

@builders = ('ExtUtils::MakeMaker') unless @builders;

create_distro(
    distro  => $distro,
    modules => [@modules],
    builder => [@builders],
);

print "Created starter directories and files\n";


=head1 SYNOPSIS

module-starter [options]

Options:

    --module=module  Module name (repeatable)
    --distro=name    Distribution name (optional)
    --dir            Directory name to create new module in (optional)

    --builder=module Build with 'ExtUtils::MakeMaker' or 'Module::Build'
    --eumm           Same as --build=ExtUtils::MakeMaker
    --mb             Same as --build=Module::Build

    The builder options may be repeated to create files for multiple builders.

    --author=name    Author's name (required)
    --email=email    Author's email (required)

    --license=type   License under which the module will be distributed
                     (default is the same license as perl)

    --help           Show this message

Example:

    module-starter --module=Foo::Bar,Foo::Bat \
        --author="Andy Lester" --email=andy@petdance.com

=cut

