Hi,
I'd like to subclass a non moose class Math::VectorReal so that I can do this
my $vec = new MyVector(x=>4, y=>3, z=>0);
and somehow fiddle with the arguments to effectively call:
my $vec = new Math::VectorReal(4, 3, 0);
I've been trying something like this:
package MyVector;
use Moose;
use MooseX::NonMoose;
use namespace::autoclean;
extends 'Math::VectorReal';
has [qw(x y z)] => (
isa => 'Num',
is => 'rw',
);
sub FOREIGNBUILDARGS {
my $class = shift;
my $n;
my @values = grep { $n++ % 2 } @_;
return @values;
}
But its not working, I guess because of the first caveat on the manual page
that says that references must be the same between the moose class and the
non-moose class. I'm a bit lost to be honest, could someone point me in the
right direction?
Thanks very much,
Matt.