a newbie encounters difficulties in using module

R

Rose

I'm testing the codes obtained from internet:


use Imager;
use Imager::plot;

$plot = Imager::plot->new(Width => 550,
Height => 350,
GlobalFont => 'ImUgly.ttf');

my @X = 0..100;
my @Y = map { sin($_/10) } @X;
my @Z = map { 1+cos($_/10) } @X;

$plot->AddDataSet(X => \@X, Y => \@Z);
$plot->AddDataSet(X => \@X, Y => \@Y,
style=>{marker=>{size => 2,
symbol => 'circle',
color => Imager::Color->new('red'),
},
});

$img = Imager->new(xsize=>600, ysize => 400);
$img->box(filled=>1, color=>'white');

$plot->{'Ylabel'} = 'angst';
$plot->{'Xlabel'} = 'time';
$plot->{'Title'} = 'Quality time';

$plot->Render(Image => $img, Xoff => 40, Yoff => 370);
$img->write(file => "testout.png");

I have already installed Imager module by CPAN.

install Imager

then by

install Color

And when I ran the test.pl by perl test.pl, the following error appears.
What else should I do?

Can't locate Imager/Color.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at
Imager.pm line 7.
BEGIN failed--compilation aborted at Imager.pm line 7.
Compilation failed in require at tst.pl line 1.
BEGIN failed--compilation aborted at tst.pl line 1.
 
B

Ben Morrow

Quoth "Rose said:
I'm testing the codes obtained from internet:


use Imager;
use Imager::plot;
I have already installed Imager module by CPAN.

install Imager

then by

install Color

There is a module called 'Color' on the CPAN, but it has nothing to do
with Imager. If you meant Imager::Color, then that is part of the Imager
distribution and should have been installed along with Imager.
And when I ran the test.pl by perl test.pl, the following error appears.
What else should I do?

Can't locate Imager/Color.pm in @INC (@INC contains:

This makes no sense. Somehow you seem to have installed Imager.pm
without Imager/Color.pm, which should be impossible. I would suggest you
try reinstalling Imager.

Ben
 
M

Michele Dondi

This makes no sense. Somehow you seem to have installed Imager.pm
without Imager/Color.pm, which should be impossible. I would suggest you
try reinstalling Imager.

Unless she "installed" by copying Imager.pm into the appropriate
directory, which in "I'm testing the codes obtained from internet"
context may not be completely unreasonable as a possibility.


Michele
 
B

Ben Morrow

Quoth Michele Dondi said:
Unless she "installed" by copying Imager.pm into the appropriate
directory, which in "I'm testing the codes obtained from internet"
context may not be completely unreasonable as a possibility.

No, but she did say

which ought to have done the right thing.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Error in ParseExcel 3
SNMP.pm 4
Filename variable going away 5
problems with Compress::Zlib 0
Can't locate POE.pm in @INC 3
Can't locate Expect.pm 1
perl build.PL create an error 2
duplicates in @INC 4

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top