Dist-Maker
view release on metacpan or search on metacpan
lib/Dist/Maker/Template/CLI.pm view on Meta::CPAN
package Dist::Maker::Template::CLI;
use utf8;
use Mouse;
use MouseX::StrictConstructor;
extends 'Dist::Maker::Template::Default';
with 'Dist::Maker::Template';
sub distribution {
return <<'DIST';
: cascade Default;
:# @@ Makefile.PL
: after mpl_requires {
requires 'Getopt::Long' => '2.37';
: }
: after mpl_footer {
install_script '<: $dist.moniker :>';
: }
:# @@ lib/$dist.module_path
: after module_code -> {
use Getopt::Long ();
sub getopt_spec {
return(
'version',
'help',
);
}
sub getopt_parser {
return Getopt::Long::Parser->new(
config => [qw(
no_ignore_case
bundling
no_auto_abbrev
)],
);
}
sub appname {
my($self) = @_;
require File::Basename;
return File::Basename::basename($0);
}
sub new {
my $class = shift;
local @ARGV = @_;
my %opts;
my $success = $class->getopt_parser->getoptions(
\%opts,
$class->getopt_spec());
if(!$success) {
$opts{help}++;
$opts{getopt_failed}++;
}
$opts{argv} = \@ARGV;
return bless \%opts, $class;
}
sub run {
my $self = shift;
( run in 0.583 second using v1.01-cache-2.11-cpan-39bf76dae61 )