Subclassing non moose classes

[email protected] ("matthew couchman (JIC)")
Newsgroups perl.moose
Message-ID <1BBF1266FD8E1B4781FB0DC46F0E55330A92DD73CB@nbiexch1.nbi.bbsrc.ac.uk>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.