Boldra has asked for the wisdom of the Perl Monks concerning the following question:
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:
Then in the script I expected to be able to write: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 { ... }
And the run sub would be executed if the user provided db and proxy, and the user would get help information if not.#!/usr/bin/perl use Igner::App::URL; Igner::App::URL->new_with_command->run;
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What's a MooseX Command
by karlgoethebier (Abbot) on Aug 06, 2024 at 10:51 UTC | |
by Boldra (Curate) on Aug 06, 2024 at 12:33 UTC | |
|
Re: What's a MooseX Command
by Danny (Chaplain) on Aug 06, 2024 at 18:44 UTC |