App-Cmd-Starter
view release on metacpan or search on metacpan
lib/Module/Starter/Plugin/App/Cmd.pm view on Meta::CPAN
when ($main_module) {
$self->main_module_guts($module, $rtname);
}
when ("$main_module"."::Command") {
$self->command_pm_guts($module);
}
when (/($main_module\b::Command)::(\w+)/) {
$self->command_module_guts($module, $1, lc $2);
}
default {
$self->SUPER::module_guts($module, $rtname);
}
}
}
#-------------------------------------------------------------------------------
sub main_module_guts {
my $self = shift;
my $module = shift;
lib/Module/Starter/Plugin/App/Cmd.pm view on Meta::CPAN
package $module;
use App::Cmd::Setup -command;
sub opt_spec {
my ( \$class, \$app ) = \@_;
# Example options
#
# return (
# [ 'name=s' => "Name", {default => \$SUPER::config->{name} || undef} ],
# );
return ();
}
sub validate_args {
my ( \$self, \$opt, \$args ) = \@_;
# Example validation
#
# \$self->usage_message('Your error here') unless (\$some_condition);
lib/Module/Starter/Plugin/App/Cmd.pm view on Meta::CPAN
# Command specific options
sub opt_spec {
my (\$class, \$app) = \@_;
return (
# Example options
#
# [ "familiar" => "Use an informal greeting", {default => \$SUPER::config->{familiar} || undef} ],
\$class->SUPER::opt_spec, # Include global options
);
}
# The command itself
sub execute {
my (\$self, \$opt, \$args) = \@_;
# require 'My::Dependency';
( run in 0.313 second using v1.01-cache-2.11-cpan-4face438c0f )