App-Cmd-Starter

 view release on metacpan or  search on metacpan

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

    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';
    # Tip: Using 'require' instead of 'use' will save memory and make startup faster

    # Command code goes here
}

1;
EOT
}


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

sub create_script {
    my $self = shift;
    
    my $script_dir = File::Spec->catdir($self->{basedir}, 'script');
    unless (-d $script_dir) {
        local @ARGV = $script_dir;
        mkpath @ARGV;
        $self->progress("Created $script_dir");
    }
    
    my $script_file = File::Spec->catfile($script_dir, $self->{script});
    $self->create_file($script_file, <<EOT);
#! /usr/bin/env perl

use $self->{main_module};
$self->{main_module}->run;
EOT
    $self->progress("Created $script_file");
}


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

sub post_create_distro {
    my $self = shift;
}


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

=head1 AUTHOR

Jon Allen (JJ), C<< <jj at jonallen.info> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-module-starter-plugin-app-cmd at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Starter-Plugin-App-Cmd>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.




=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Module::Starter::Plugin::App::Cmd


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Module-Starter-Plugin-App-Cmd>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Module-Starter-Plugin-App-Cmd>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Module-Starter-Plugin-App-Cmd>

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.277 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )