File Coverage

blib/lib/MooseX/App/Plugin/Term.pm
Criterion Covered Total %
statement 11 13 84.6
branch n/a
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 15 19 78.9


line stmt bran cond sub pod time code
1             # ============================================================================
2             package MooseX::App::Plugin::Term;
3             # ============================================================================
4              
5 1     1   6728 use 5.010;
  1         4  
6 1     1   6 use utf8;
  1         2  
  1         9  
7              
8 1     1   26 use namespace::autoclean;
  1         1  
  1         7  
9 1     1   95 use Moose::Role;
  1         2  
  1         7  
10              
11             sub plugin_metaroles {
12 0     0 0   my ($self,$class) = @_;
13              
14             return {
15 0           class => ['MooseX::App::Plugin::Term::Meta::Class'],
16             attribute => ['MooseX::App::Plugin::Term::Meta::Attribute'],
17             }
18             }
19              
20             1;
21              
22             __END__
23              
24             =encoding utf8
25              
26             =head1 NAME
27              
28             MooseX::App::Plugin::Term - Allows one to specify options/parameters via terminal prompts
29              
30             =head1 SYNOPSIS
31              
32             In your base class:
33              
34             package MyApp;
35             use MooseX::App qw(Term);
36              
37             In your command class:
38              
39             package MyApp::SomeCommand;
40             use MooseX::App::Command;
41            
42             option 'some_option' => (
43             is => 'rw',
44             isa => 'Int',
45             documentation => 'Something',
46             cmd_term => 1,
47             );
48            
49             sub run {
50             my ($self) = @_;
51             say "Some option is ".$self->some_option;
52             }
53              
54             In your shell
55              
56             bash$ myapp some_command
57             Something (Required, an integer):
58             test
59             Value must be an integer (not 'test')
60             1
61            
62             Some option is 1
63              
64             =head1 DESCRIPTION
65              
66             This plugin can prompt the user for missing options/parameters on the
67             terminal. The user will only be promted if the parameter were not provided
68             by different means (parameter and option or config files and environment
69             values if the respectice plugins have been loaded before this plugin) and
70             if the script is connected to an interactive terminal.
71              
72             Term input has basic editing capabilities (cursor, del, backspace and history)
73              
74             =cut
75              
76