-
-
24 Apr 2017 14:26:02 UTC
- Distribution: MooX-Options-Actions
- Module version: 0.001
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (609 / 5 / 7)
- Kwalitee
Bus factor: 0- 93.62% Coverage
- License: perl_5
- Perl: v5.8.5
- Activity
24 month- Tools
- Download (9.92KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
MooX::Options::Actions - Instant one class CLI App
SYNOPSIS
In MyApp::Script:
package MyApp::Script; use MooX::Options::Actions; option 'boo' => ( is => 'ro', format => 's', required => 1, doc => "Surprise!" ); sub cmd_dump { my ( $self ) = @_; print "Message: [" . $self->boo . "]\n"; } 1;
In script.pl:
#! /usr/bin/env perl use strict; use warnings; use MyApp::Script; MyApp::Script->new_with_actions;
On the command line:
$ ./script.pl dump --boo Hello Message: [Hello]
DESCRIPTION
MooX::Options::Actions is a set of packages designed to make setting up and creating command line applications really easy. It automatically imports Moo, MooX::Options, namespace::clean, and a "new_with_actions" in MooX::Options::Actions::Builder function to set up the top level commands. this means you only need to include this one module, and then you can set up options as from MooX::Options, and set up commands to act on those options by creating subroutines with the
cmd_
prefix.AUTHOR
Tom Bloor <t.bloor@shadowcat.co.uk>
COPYRIGHT
Copyright 2017- Tom Bloor
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Module Install Instructions
To install MooX::Options::Actions, copy and paste the appropriate command in to your terminal.
cpanm MooX::Options::Actions
perl -MCPAN -e shell install MooX::Options::Actions
For more information on module installation, please visit the detailed CPAN module installation guide.