MooseX::Runnable(3pm)
π MooseX::Runnable β the manual page, but make it a group chat π
okay bestie, so this is MooseX::Runnable, and it lives in the User Contributed Perl Documentation section (that's the 3pm part, iykyk). it's giving "tag your class as a runnable app" and honestly? iconic. let's go. π«Ά
β¨ NAME β¨
MooseX::Runnable β literally just tags a class as a runnable application. that's the whole job. she's lowkey a queen for it. π
πΈ VERSION πΈ
version 0.10 β that's the vibe we're on, no cap.
π¦ SYNOPSIS π¦
so the move is: make a class, tag it runnable, and hand over a run method. like this:
package App::HelloWorld;
use feature 'say';
use Moose;
with 'MooseX::Runnable';
sub run {
my ($self,$name) = @_;
say "Hello, $name.";
return 0; # success
}
then boom, you can run that class as an actual application using the included mx-run script:
$ mx-run App::HelloWorld jrockway
Hello, jrockway.
$
and bestie, listen β MooseX::Runnable plays nice with MooseX::Getopt, and with other similar systems too. and if you've written one of those systems yourself? she's extensible, so come through. β¨
π DESCRIPTION π
MooseX::Runnable is a framework for making classes into runnable applications. and honestly? this role doesn't do anything fancy β all it does is tell the rest of the framework "hey, this class is a runnable application, and it has a run method that takes arguments and returns the process' exit code." that's it. that's the whole assignment. π
this is a convention the community has been riding with for a minute now. this role just tells the computer that your class follows this convention, and it lets the computer abstract away some of the tedious stuff that comes with it. the computer is doing your chores. slay. π§
π REQUIRED METHODS π
π run
your class must implement run. periodt. it accepts the command-line args (the ones that weren't already eaten by another parser, if that applies to you) and it returns an integer representing the UNIX exit value. so return 0 means success. π
π₯ THINGS YOU GET π₯
π mx-run
this is a script that accepts a MooseX::Runnable class and tries to run it, using MooseX::Runnable::Run.
the syntax is:
mx-run Class::Name
mx-run <args for mx-run> -- Class::Name <args for Class::Name>
for example:
mx-run -Ilib App::HelloWorld --args --go --here
or:
mx-run -Ilib +Persistent --port 8080 -- App::HelloWorld --args --go --here
see how the -- is the little dividing line between "args for mx-run" and "args for your class"? she's a bouncer. π
π¦ MooseX::Runnable::Run
if you don't wanna invoke your app with mx-run, that's totally fine β you can write your own custom version using MooseX::Runnable::Run. DIY queen behavior. β¨
π ARCHITECTURE π
MX::Runnable is designed to be extensible, which means:
- users can run plugins straight from the command-line π
- application developers can add roles to their class to control behavior π
for example, if you consume MooseX::Getopt, the command-line gets parsed with MooseX::Getopt. any recognized args get used to instantiate your class, and any extra args get passed along to run. the leftovers get re-gifted. iconic. π
π CAVEATS π
bestie, listen to me very carefully: many of the plugins shipped are unstable. they may go away, change, break, etc. π
and if there is no documentation for a plugin, it is probably just a prototype. proceed accordingly, my love. π
π«Ά SUPPORT π«Ά
bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Runnable> β or, if email is more your thing, bug-MooseX-Runnable@rt.cpan.org <mailto:bug-MooseX-Runnable@rt.cpan.org>.
there's also a mailing list for users of this distribution, at <http://lists.perl.org/list/moose.html>. join the chat, we're all here. π
and there's an irc channel too, for users of this distribution: #moose on irc.perl.org <irc://irc.perl.org/#moose>. come say hi. πΈ
β AUTHOR β
Jonathan Rockway <jrockway@cpan.org> β the originator, the blueprint, the moment. π
π CONTRIBUTORS π
- Jonathan Rockway <jon@jrock.us>
- Karen Etheridge <ether@cpan.org>
- Doug Bell <doug.bell@baml.com>
- Duke Leto <jonathan@leto.net>
the whole squad ate. no crumbs left. π₯
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2009 by Jonathan Rockway.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, bestie. π this was rendered for you by perl v5.36.0, dated 2022-12-11, and it's the MooseX::Runnable(3pm) page β now go tag something runnable and make it everyone's problem. mwah. π
β¨π¦
π¦ where this page comes from
- debian bookworm: libmoosex-runnable-perl 0.10-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-runnable-perl 0.10-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-runnable-perl 0.10-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libmoosex-runnable-perl 0.10-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms