1App::Cmd::Setup(3) User Contributed Perl Documentation App::Cmd::Setup(3)
2
3
4
6 App::Cmd::Setup - helper for setting up App::Cmd classes
7
9 version 0.334
10
12 App::Cmd::Setup is a helper library, used to set up base classes that
13 will be used as part of an App::Cmd program. For the most part you
14 should refer to the tutorial for how you should use this library.
15
16 This class is useful in three scenarios:
17
18 when writing your App::Cmd subclass
19 Instead of writing:
20
21 package MyApp;
22 use parent 'App::Cmd';
23
24 ...you can write:
25
26 package MyApp;
27 use App::Cmd::Setup -app;
28
29 The benefits of doing this are mostly minor, and relate to sanity-
30 checking your class. The significant benefit is that this form
31 allows you to specify plugins, as in:
32
33 package MyApp;
34 use App::Cmd::Setup -app => { plugins => [ 'Prompt' ] };
35
36 Plugins are described in App::Cmd::Tutorial and App::Cmd::Plugin.
37
38 when writing abstract base classes for commands
39 That is: when you write a subclass of App::Cmd::Command that is
40 intended for other commands to use as their base class, you should
41 use App::Cmd::Setup. For example, if you want all the commands in
42 MyApp to inherit from MyApp::Command, you may want to write that
43 package like this:
44
45 package MyApp::Command;
46 use App::Cmd::Setup -command;
47
48 Do not confuse this with the way you will write specific commands:
49
50 package MyApp::Command::mycmd;
51 use MyApp -command;
52
53 Again, this form mostly performs some validation and setup behind
54 the scenes for you. You can use "base" if you prefer.
55
56 when writing App::Cmd plugins
57 App::Cmd::Plugin is a mechanism that allows an App::Cmd class to
58 inject code into all its command classes, providing them with
59 utility routines.
60
61 To write a plugin, you must use App::Cmd::Setup. As seen above,
62 you must also use App::Cmd::Setup to set up your App::Cmd subclass
63 if you wish to consume plugins.
64
65 For more information on writing plugins, see App::Cmd::Manual and
66 App::Cmd::Plugin.
67
69 This module has a long-term perl support period. That means it will
70 not require a version of perl released fewer than five years ago.
71
72 Although it may work on older versions of perl, no guarantee is made
73 that the minimum required version will not be increased. The version
74 may be increased for any reason, and there is no promise that patches
75 will be accepted to lower the minimum required perl.
76
78 Ricardo Signes <rjbs@semiotic.systems>
79
81 This software is copyright (c) 2021 by Ricardo Signes.
82
83 This is free software; you can redistribute it and/or modify it under
84 the same terms as the Perl 5 programming language system itself.
85
86
87
88perl v5.34.0 2021-07-22 App::Cmd::Setup(3)