MooseX::App::Cmd(3pm)
๐ MooseX::App::Cmd ๐
okay bestie, this is a page from the User Contributed Perl Documentation for MooseX::App::Cmd(3pm), and it's literally the moment your command-line app gets a glow-up โจ
๐ฆ NAME ๐ฆ
MooseX::App::Cmd โ mashes up MooseX::Getopt and App::Cmd ๐
โญ VERSION โญ
version 0.34 โ yes, that's the whole vibe check, no cap ๐
๐ธ SYNOPSIS ๐ธ
here's the whole situation, copy-paste ready:
package YourApp::Cmd;
use Moose;
extends qw(MooseX::App::Cmd);
package YourApp::Cmd::Command::blort;
use Moose;
extends qw(MooseX::App::Cmd::Command);
has blortex => (
traits => [qw(Getopt)],
isa => 'Bool',
is => 'rw',
cmd_aliases => 'X',
documentation => 'use the blortext algorithm',
);
has recheck => (
traits => [qw(Getopt)],
isa => 'Bool',
is => 'rw',
cmd_aliases => 'r',
documentation => 'recheck all results',
);
sub execute {
my ( $self, $opt, $args ) = @_;
# you may ignore $opt, it's in the attributes anyway
my $result = $self->blortex ? blortex() : blort();
recheck($result) if $self->recheck;
print $result;
}
look at those cmd_aliases, look at that documentation key โ she's serving โจ
๐ DESCRIPTION ๐
so this module marries App::Cmd with MooseX::Getopt. iconic crossover event, honestly ๐ซถ
use it exactly how App::Cmd tells you to (and seriously, go read App::Cmd::Tutorial, it's giving tutorial, it's giving helpful), except you swap App::Cmd::Command out for MooseX::App::Cmd::Command. one swap. that's it. slay.
and then? you get to write your moose commands as Moose classes, and MooseX::Getopt defines all the options for you โ instead of some opt_spec returning a Getopt::Long::Descriptive spec. the boilerplate? gone. not me being emotional about it ๐ญ
๐ METHODS ๐
๐ง BUILD ๐ง
after new gets called, this method runs automatically, all by itself, no prompting โ it sets the underlying App::Cmd attributes as per its documentation. main character energy, fr fr.
๐ SEE ALSO ๐
the friend group:
App::CmdApp::Cmd::TutorialMooseX::GetoptMooseX::App::Cmd::Command
๐ฆ SUPPORT ๐ฆ
bugs? bestie, they can be submitted through the RT bug tracker โ <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-App-Cmd> โ or by email to bug-MooseX-App-Cmd@rt.cpan.org <mailto:bug-MooseX-App-Cmd@rt.cpan.org>. ๐โก๏ธ๐ฎ
there's also a mailing list for users of this distribution, right here: <http://lists.perl.org/list/moose.html>. ๐
and there's also an irc channel for users of this distribution โ #moose on irc.perl.org <irc://irc.perl.org/#moose>. come hang, iykyk ๐ฌ
โจ AUTHOR โจ
XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org>
๐ CONTRIBUTORS ๐
the whole squad, absolutely ate:
- Mark Gardner <mjgardner@cpan.org>
- Karen Etheridge <ether@cpan.org>
- Graham Knop <haarg@haarg.org>
- Daisuke Maki <dmaki@cpan.org>
- Offer Kaye <offer.kaye@gmail.com>
- brunov <vecchi.b@gmail.com>
- Ken Crowell <oeuftete@gmail.com>
- vovkasm <vovkasm@gmail.com>
- Dann <techmemo@gmail.com>
- Guillermo Roditi <groditi@gmail.com>
- Michael Joyce <ubermichael@gmail.com>
๐ COPYRIGHT AND LICENCE ๐
this software is copyright (c) 2008 by Infinity Interactive, Inc. ๐ซถ
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
๐ tl;dr โ it's free, go wild, same terms as Perl 5 itself. periodt.
okay that's the whole page, ty for coming to my ted talk ๐
this was MooseX::App::Cmd(3pm) from the perl v5.36.0 docs, dated 2022-10-16 โ so if you're reading this, hi from the past, hope your command line is thriving, mwah ๐๐ธ
๐ฆ where this page comes from
- ubuntu noble: libmoosex-app-cmd-perl 0.34-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-app-cmd-perl 0.34-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-app-cmd-perl 0.34-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms