toothedsword has asked for the wisdom of the Perl Monks concerning the following question:
I have written a CV.pm(perl5/5.30.0/lib/site_perl/5.30.0/x86_64-linux/PDL/CV.pm) as below:
Then I wrote a test.pl as below:package PDL::CV; use strict; our @EXPORT=qw(rp); sub rp { my ( $self, $input ) = @_; $self .= $input->reshape($self->dims); return $self; } sub new { my $class = shift; my $self = { _input => shift, }; bless $self, $class; return $self; } 1;
use v5.10; use PDL; use PDL::NiceSlice; use PDL::CV; $d = sequence(4,5); $t = pdl sequence(100,5,5); $d(0,1:4)->rp($t(0,0,1:4));
When I ran this scripts, I get this message: Can't locate object method "rp" via package "PDL" at test_pdl6.pl line 28. If I do not want using $d(0,1:4)->PDL::CV::rp($t(0,0,1:4)); just using $d(0,1:4)->rp($t(0,0,1:4)); How should I do?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to export a method
by choroba (Cardinal) on Oct 22, 2019 at 06:19 UTC | |
by etj (Priest) on Apr 28, 2022 at 15:06 UTC | |
|
Re: how to export a method
by wanna_code_perl (Friar) on Oct 22, 2019 at 02:48 UTC | |
by afoken (Chancellor) on Oct 22, 2019 at 20:30 UTC | |
by wanna_code_perl (Friar) on Oct 23, 2019 at 07:38 UTC | |
by toothedsword (Sexton) on Oct 23, 2019 at 00:07 UTC | |
by toothedsword (Sexton) on Oct 22, 2019 at 03:17 UTC | |
by wanna_code_perl (Friar) on Oct 22, 2019 at 03:48 UTC | |
by toothedsword (Sexton) on Oct 22, 2019 at 05:45 UTC | |
by AnomalousMonk (Archbishop) on Oct 22, 2019 at 06:36 UTC | |
| |
by wanna_code_perl (Friar) on Oct 22, 2019 at 05:56 UTC | |
by toothedsword (Sexton) on Oct 22, 2019 at 06:05 UTC |