MooseX::App::Cmd(3pm)

๐Ÿ“ฆ
version 0.34 ยท 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

๐Ÿ’– 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::Cmd
  • App::Cmd::Tutorial
  • MooseX::Getopt
  • MooseX::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>

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