Tsuyoshi,

Try this:

----%<----
use Moose;
use PDL::Lite;
use PDL::Graphics::PLplot;
...
---->%----

In order to use PDL constructors such as sequence, zeros, or grandom, you
will need to invoke the method on the PDL package, i.e.

my $foo = PDL->zeros(20);
my $bar = PDL->grandom(30);

But all *method* calls will work just fine:

my $sum = $bar->sum;

PDL::Lite does not import any methods into the calling package (except
maybe barf... and one or two others...) so this should prevent the inner()
conflict.

Hope that helps!
David


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
>



-- 
 "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

Reply via email to