docdurdee has asked for the wisdom of the Perl Monks concerning the following question:
creates a mercury atom with three MVR coordinates. The coords attribute is an ArrayRef-MVR with Array traits; I push_coords, get_coords, set_coords etc. I have two goals: 1. be able to use MVR's V function without having to add use Math::Vector::Real to every script. 2. be able to add MooseX::Storage capabilities for MVR to my classes. So I'm trying to subclass MVR:my $atom = Atom->new(Z=> 80, coords => [V(0,0,0), V(1,1,1), V(2,2,2)]) +;
now using MVR->new works,package MyMVR; #ABSTRACT: Moose subclass of Math::Vector::Real use 5.008; use Moose; use namespace::autoclean; use MooseX::NonMoose; use MooseX::Storage; with Storage ('io' => 'StorableFile' ); extends 'Math::Vector::Real'; __PACKAGE__->meta->make_immutable; 1;
with Moose warnings (that make sense) about MyMVR's new: "The new() method for MyMVR expects a hash reference or a key/value list. You passed an odd number of arguments at MyMVR_test.pl". The V function is no longer accessible. Any help achieving either goal is greatly appreciated! Duse MyMVR; my $a = MyMVR->new(0,0,0); my $b = MyMVR->new(1,1,1); print $_ ."\n" foreach (@{$a - $b});
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: subclassing Math::Vector::Real with MooseX::NonMoose
by tobyink (Canon) on Sep 12, 2013 at 14:47 UTC | |
by docdurdee (Scribe) on Sep 12, 2013 at 15:52 UTC | |
|
Re: subclassing Math::Vector::Real with MooseX::NonMoose
by salva (Canon) on Sep 12, 2013 at 15:44 UTC | |
by docdurdee (Scribe) on Sep 12, 2013 at 15:58 UTC |