one more thing, when I call

Test->new( ver => 2, otherval => 3 );
the delegation would pass otherval => 3 to Test::V2 too.

Thanks for any tip.

On Sat, Apr 18, 2009 at 7:51 PM, Fayland Lam <fayl...@gmail.com> wrote:
> see I have Test::V1 and Test::V2.
>
> package Test::V1;
> use Moose;
> has 'var' => ( default => 1 );
> package Test::V2;
> use Moose;
> has 'var' => (default => 2 );
>
> then I have a Test
> package Test;
> use Moose;
> has 'ver' => ( required => 1 );
>
> I want something like follows:
> my $t1 = Test->new( ver => 1);
> print $t1->var; # 1;
> my $t2 = Test->new( ver => 2 );
> print $t2->var; # 2
>
> in V1 and V2, there would be something more than 'var' and have different 
> subs.
> how to delegate depends on the 'ver' in Test? any hint?
>
> Thanks.
>
> --
> Fayland Lam // http://www.fayland.org/
> Foorum based on Catalyst // http://www.foorumbbs.com/
>



-- 
Fayland Lam // http://www.fayland.org/
Foorum based on Catalyst // http://www.foorumbbs.com/

Reply via email to