Hello, i'm not sure why that is happening with your classes, can you provide
us with some code?

Here is a little code snippet which does the same as you described and works
just fine. Hope that helps.

package MyApp;
use Moose;

extends 'MooseX::App::Cmd';

package MyApp::Command;
use Moose;

has 'bam' => ( isa => 'Str', is => 'rw', required => 1 );

package MyApp::Command::foo;
use Moose;

extends 'MyApp::Command', 'MooseX::App::Cmd::Command';

has 'foo' => ( isa => 'Str', is => 'rw', required => 1 );

package MyApp::Command::bar;
use Moose;

extends 'MyApp::Command', 'MooseX::App::Cmd::Command';

has 'bar' => ( isa => 'Str', is => 'rw', required => 1 );

package main;

MyApp->new->run;

On Tue, Dec 15, 2009 at 5:28 PM, Rolf Schaufelberger <r...@plusw.de> wrote:

> Hi,
>
> how can  I  implement  several commands (= subclasses ) and each subclass
> have its own parameters ?
>
> Say I have:
> MyApp::Command     Base class    defines param   B1  and B2 as required
> MyApp::Command::CmdA               defines param  A1 as required
> MyApp:Command::CmdX                 defines param X1  as required
>
> and my script     site-config.pl:
> #!/usr/bin/perl
> use MyApp::Comand -run
>
>
> now when I call
> site-config.pl   CmdA   -B1=bla -B2=foo -A1=bar
>
> I get an error complaining about  missing mandatory parameter  X1
>
> but X1 is not needed to execute CmdA
>
> regards
> Rolf Schaufelberger
>
>
>
>
>


-- 
Regards,
Mikhail

Reply via email to