Since Moose always exports inner() and 'use PDL' does as
well, you'll need to "fix" the problem somehow.

Since the inner() exported by 'use PDL' is also accessible as
a method call, you can 'use PDL::Lite' to avoid exporting any
functions from PDL and call everything as a method.

A hack-ish but simple fix is to use Sub::Delete to remove
the PDL inner routine from main: before use-ing Moose.
For example, this gives a warning:

    use PDL;
    use Moose;

But this does not:

    BEGIN {
       use PDL;
       use Sub::Delete;
       delete_sub 'inner';
    }
    use Moose;

where I used a BEGIN{} block to make the delete_sub call
take place *before* the loading of Moose.

Hope this helps,
Chris


On Tue, Jul 29, 2014 at 7:50 PM, tsuyoshi okita
<[email protected]> wrote:
> Dear all,
>
> Thank you very much for your quick replies!!
> I've got pdl() part.
> So in order to make inner() NOT collide, I need to unexport inner() either
> from Moose or PDL, PDL::Graphics::PLplot.
> So you are saying I need to look into those modules and unexport either of
> them...right???
> ugghhhh....*_*
> Is there an easy way to do that??
> or do I need to unexport PDL or PDL::Graphics::PLplot and change inner() to
> PDL::inner() and so on....
>
> I just tried a following and it did not work...:
> use Moose;
> no strict;
> use PDL;
> use aliased 'PDL::Graphics::PLplot';
> use strict;
>
> thank you.
>
> Sincerely,
> Tsuyoshi Okita
>
>
>
>
> On 2014年07月30日 02:14, Chris Marshall wrote:
>>
>> On Tue, Jul 29, 2014 at 11:16 AM, Doug Hunt<[email protected]>  wrote:
>>>
>>> Hi Tsuyoshi:
>>>
>>> I've never used PDL and PDL::Graphics::PLplot with Moose.  PDL list
>>> folks:
>>> have any of you had this problem and overcome it?
>>>
>>> As to item 2, I think code like this for $y:
>>>
>>> my $y = pdl(0,1,2,104,4,5,24,7,8,99);
>>>
>>> would make things work.  Currently, your $y is a reference
>>> to a perl list, not a pdl object.
>>>
>>> Regards,
>>>
>>>    Doug Hunt
>>>
>>>
>>> [email protected]
>>> Software Engineer
>>> UCAR - COSMIC, Tel. (303) 497-2611
>>>
>>> On Tue, 29 Jul 2014, tsuyoshi okita wrote:
>>>
>>>> Hello,
>>>>
>>>> Thank you for providing us PDL::Graphics::PLplot.
>>>> I have a several questions I need to ask.  I could not find any mailing
>>>> list for PDL::Graphics::PLplot.
>>>> I just started to using PDL::Graphics::PLplot.  So my questions might
>>>> sound silly to you, but I hope you can bear with it.
>>>>
>>>> 1. I attached a simple perl code.  This is what happends.
>>>> if I add use Moose; it gives a following message:
>>
>> This is because Moose enables the strict pragma and PDL
>> exports the inner() routine which apparently collides with another
>> declaration/definition of inner().
>>
>>>> "Prototype mismatch: sub main::inner: none vs (;@) at (eval 168) line
>>>> 8."
>>>> 2. I have been trying to plot a bundle of data.
>>>> my $x = sequence(10);
>>>> my $y  = [0,1,2,104,4,5,24,7,8,99];
>>>>   $pl->xyplot($x, $y,);
>>>>   $pl->close;
>>>>
>>>> this code gives me this error message:
>>>> "Can't call method "minmax" on unblessed reference at
>>>> /usr/local/lib/perl/5.14.2/PDL/Graphics/PLplot.pm line 1595."
>>
>> As Doug points out, the problem is that PDL::Graphics::PLplot takes
>> PDL objects as input rather than perl list/list-refs.  If you need to use
>> both the list ref and a PDL object you can use the pdl() constructor
>> to make a "piddle" and the ->unpdl method to regenerate an
>> equivalent set of list refs.
>>
>>>> I understand this has to do with $y.  It works if I add my $y =
>>>> sequence(10);.
>>>> I looked into PDL::Graphics::PLplot site and plplot documents, but
>>>> nothing
>>>> mention about sequence().
>>>>
>>>> I am sure you are busy, but if you can help me out, I would be grateful.
>>
>> I'm glad Doug was able to help you out.  I recommend joining the perldl
>> mailing list which is where PDL is supported and is usually the best
>> way to get help.
>>
>> --Chris
>>
>>>> Thank you.
>>>> Tsuyoshi Okita
>
>

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to