Kaj -
Your original email immediately brought to mind some experiments by Joel
(jberger) trying to directly subclass PDL using Moo, but I couldn't find
the email. I managed to dig it up, it was to the pdl-porters:
http://mailman.jach.hawaii.edu/pipermail/pdl-porters/2013-June/005695.html.
Upshot is this:
#!/usr/bin/env perl
use strict;
use warnings;
use v5.10;
{
package MyPDL;
use Moo;
use PDL::Lite;
extends 'PDL';
}
my $x = MyPDL->xvals(10,10);
my $y = MyPDL->yvals(10,10);
say ref $x;
print $x - $y;
That said, if you simply want to create a Moo[se] class that has a PDL
attribute, you should simply be able to "use PDL::Lite" and then declare
said attribute isa => 'PDL', and you should be all set.
David
On Thu, Jun 20, 2013 at 9:45 AM, Kaj Wiik <[email protected]> wrote:
>
>
>
> On Thu, Jun 20, 2013 at 3:54 PM, Piero Ranalli <[email protected]>wrote:
>
>> this happens to me too. I usually do the following:
>>
>> use Moose 'has';
>> use PDL;
>>
>> i.e. I only import 'has', or any of the few other Moose functions I
>>
>
> OK, good idea too!
>
>
>> use. It works quite well, but I admit that my use of Moose is quite
>> primitive - i.e., I just do things such as:
>> has 'piddle' => (is => 'rw', isa => 'Any') .
>>
> I use isa => 'PDL' and it works OK out of the box (through PDL class).
>
> I have too a long but interesting path ahead :-).
>
> Thanks,
> Kaj
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
>
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl