MooseX:...in::Term(3)
π MooseX::App::Plugin::Term(3) β like, the whole vibe
okay so bestie, welcome to the MooseX::App::Plugin::Term page from the User Contributed Perl Documentation π β yes that's the manual name, and yes it's a whole thing, but the actual tea is this plugin lets your app literally ask the person at the keyboard for the stuff they forgot to type. iconic behaviour, honestly.
β¨ NAME β¨
MooseX::App::Plugin::Term β the plugin that lets you specify options/parameters via terminal prompts π«Ά
πΈ SYNOPSIS πΈ
In your base class, you do this little number:
package MyApp;
use MooseX::App qw(Term);
Then in your command class:
package MyApp::SomeCommand;
use MooseX::App::Command;
option 'some_option' => (
is => 'rw',
isa => 'Int',
documentation => 'Something',
cmd_term => 1,
);
sub run {
my ($self) = @_;
say "Some option is ".$self->some_option;
}
And then in your shell, the moment of truth π₯:
bash$ myapp some_command
Something (Required, an integer):
test
Value must be an integer (not 'test')
1
Some option is 1
like?? it asked, it validated, it slayed. periodt π
π DESCRIPTION π
So here's the lore: this plugin can prompt the user for any missing options/parameters right there on the terminal. π¦
But β and this is the key part, bestie β the user only gets prompted if:
- the parameter wasn't already provided by different means (that's a parameter and option, or config files and environment values if the respective plugins have been loaded before this plugin), and
- the script is actually connected to an interactive terminal.
no interactive terminal? no vibes, no prompt. it just doesn't happen. π
Also, lowkey the best part: term input has basic editing capabilities β cursor, del, backspace and history. it's giving "little readline that could" β¨
fr fr though: keep the loading order in mind. the config-file and environment plugins have to come before this one for their values to count as "already provided", so the prompt doesn't come for something you already answered. iykyk π
π SEE ALSO π
no SEE ALSO section here, bestie β the original page doesn't have one, so we're not inventing one. π
that's the whole manual! π cute little sign-off: this page was rendered as part of perl v5.42.0, dated 2024-08-09 β go off, perl. ππΈ
π¦ where this page comes from
- opensuse-leap 16.0: perl-MooseX-App 1.430.1-bp160.1.10 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms