I've been looking at MooseX::App documentat trying to understand what exactly is mean by a "command"...

What I'd like to do is create a base class with certain switches and functionality which will be usable across a range of separate scripts, for example:

igner-cli.pl  --db=demo "rm /dev/null"
igner-url.pl  --db=prod --proxy=none http://boldra.com/

This is what I'm trying:

package Igner::App; use MooseX::App; parameter db => ( #all igner apps need a "db" required => 1, ... ); package Igner::App::URL; extends 'Igner::App'; use MooseX::App::Command; # because this script has additional paramet +ers and options paramter proxy => ( # only Igner::App::URL needs a proxy required => 1, ... ); sub run { ... }
Then in the script I expected to be able to write:
#!/usr/bin/perl use Igner::App::URL; Igner::App::URL->new_with_command->run;
And the run sub would be executed if the user provided db and proxy, and the user would get help information if not.

Instead, I'm getting "new_with_command may only be called from the application base package:Igner::App::URL" which doesn't shed any light. As I said at the start - I'm lacking a clear concept of what the modules mean by "command". The MooseX::App::Command documentation could use some examples of how it relates to actually executing commands on the command-line.



- Boldra

In reply to What's a MooseX Command by Boldra

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.