1App::CLI::Command(3)  User Contributed Perl Documentation App::CLI::Command(3)
2
3
4

NAME

6       App::CLI::Command - Base class for App::CLI commands
7

SYNOPSIS

9           package MyApp::List;
10           use base qw(App::CLI::Command);
11
12           use constant options => (
13               'verbose'   => 'verbose',
14               'n|name=s'  => 'name',
15           );
16
17           sub run {
18               my ( $self, $arg ) = @_;
19
20               print "verbose" if $self->{verbose};
21
22               my $name = $self->{name}; # get arg following long option --name
23
24               # anything you want this command do
25           }
26
27           # See App::CLI for information of how to invoke (sub)command.
28

DESCRIPTION

30       subcommand()
31
32           return old genre subcommand of $self;
33
34       cascading()
35
36       Return instance of cascading subcommand invoked if it was listed in
37       your constant subcommands.
38
39       cascadable()
40
41       Return package name of subcommand if the subcommand invoked is in your
42       constant subcommands, otherwise, return "undef".
43
44       app
45
46       Return the object referring to the current app.
47
48       brief_usage ($file)
49
50       Display a one-line brief usage of the command object.  Optionally, a
51       file could be given to extract the usage from the POD.
52
53       usage ($want_detail)
54
55       Display usage.  If $want_detail is true, the "DESCRIPTION" section is
56       displayed as well.
57
58       loc_text $text
59
60       Localizes the body of (formatted) text in $text and returns the
61       localized version.
62
63       filename
64
65       Return the filename for the command module.
66

SEE ALSO

68       App::CLI, Getopt::Long
69

AUTHORS

71       Chia-liang Kao <clkao@clkao.org>
72
73       Cornelius Lin  <cornelius.howl@gmail.com>
74
75       Shelling       <navyblueshellingford@gmail.com>
76
77       Paul Cochrane  <paul@liekut.de> (current maintainer)
78
80       Copyright 2005-2006 by Chia-liang Kao <clkao@clkao.org>.
81
82       This program is free software; you can redistribute it and/or modify it
83       under the same terms as Perl itself.
84
85       See <http://www.perl.com/perl/misc/Artistic.html>
86
87
88
89perl v5.32.1                      2021-01-26              App::CLI::Command(3)
Impressum