in reply to how to export a method
package PDL::CV; use parent qw{ PDL }; # Tell Perl what your parent class is. sub rp { my ($self, $input) = @_; $self .= $input->reshape($self->dims); return $self } sub new { my $class = shift; return bless { PDL => shift, # See PDL::Objects for details. }, $class }
You also need to instantiate the new class:
my $d = PDL::CV->new(sequence(4,5)); my $t = pdl sequence(100,5,5); $d(0,1:4)->rp($t(0,0,1:4));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to export a method
by etj (Priest) on Apr 28, 2022 at 15:06 UTC |