App-Cmd-Starter

 view release on metacpan or  search on metacpan

lib/Module/Starter/Plugin/App/Cmd.pm  view on Meta::CPAN

        catfile(File::HomeDir->my_home, '.$script'),
        '/usr/local/etc/$script',
        '/etc/$script',
    );
     
    foreach my \$file (grep {defined \$_} \@files) {
        return \$file if -r \$file;
    }
}

\=head1 SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

    use $module;

    my \$foo = $module->new();
    ...

\=head1 AUTHOR

$self->{author}, C<< <$self->{email_obfuscated}> >>

$bugs

$support

$license

\=cut

1; # End of $module
HERE
    return $content;
}


#-------------------------------------------------------------------------------

sub command_pm_guts {
    my ($self, $module) = @_;
    
    return <<EOT;
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);
}

1;
EOT
}


#-------------------------------------------------------------------------------

sub command_module_guts {
    my ($self, $module, $base, $command) = @_;
    
    return <<EOT;
package $module;

use strict;
use warnings;
use parent '$base';

# Documentation

sub abstract {
    return "Abstract for the $command command";
}
 
sub usage_desc {
    return "%c $command %o";
}
 
sub description {
    return "Description for the $command command\\nOptions:";
}


# 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 1.635 second using v1.01-cache-2.11-cpan-140bd7fdf52 )