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/

Reply via email to