Chart::Gnuplot problem

V

Vicky Conlan

I've got a little bit of a problem. I'm not sure if I'm doing something
daft or if I've got a bad installation, but because I don't have any control
over the install I'm having trouble telling what is wrong.

So I've got a fairly simple script which I developed on a freeBSD machine
whilst I waited for the install on the machine at work. It is fairly basic,
it has a couple of datasets, blah blah, then it draws some filled curves.
And it works fine. (output: http://comps.org/fig/simple.png )

Then I tried exactly the same code on a solaris 10 zone and got the ever-
so-unhelpful error:

"/tmp/2sp97fafGp/plot", line 1: undefined variable: noenhanced

There is no reference to noenhanced in /my/ code. There are various bits
in the Gnuplot module that mention it, but noenhanced is the default, so I
don't see why it would work on one and not the other.

The only possibly relevant difference I can spot is that the working copy
uses gnuplot 4.2 patchlevel 3, the not-working uses 4.0 patchlevel 0

Any chance anyone has experienced this and can give me some subtle hints
about what could be the problem? (thanks)

--
 
J

Jim Gibson

Vicky Conlan said:
I've got a little bit of a problem. I'm not sure if I'm doing something
daft or if I've got a bad installation, but because I don't have any control
over the install I'm having trouble telling what is wrong.

So I've got a fairly simple script which I developed on a freeBSD machine
whilst I waited for the install on the machine at work. It is fairly basic,
it has a couple of datasets, blah blah, then it draws some filled curves.
And it works fine. (output: http://comps.org/fig/simple.png )

Then I tried exactly the same code on a solaris 10 zone and got the ever-
so-unhelpful error:

"/tmp/2sp97fafGp/plot", line 1: undefined variable: noenhanced

Did you look in directory /tmp/2sp97fafGp for a file called plot? If
you look at the source of Chart::Gnuplot:

(<http://search.cpan.org/src/KWMAK/Chart-Gnuplot-0.06/lib/Chart/Gnuplot.
pm>),

it looks like it creates a file of that name containing commands to
gnuplot. Some of those commands, such as 'title' or 'set xlabel' can
contain the string 'noenhanced'. The question is why the string
'noenhanced' is being interpreted as a variable. While Chart::Gnuplot
probably attempts to clean up its files, your program may crash before
it has a chance to do so. So look in that directory and see if the
files are left around. If so, try sending the file to gnuplot and see
what happens.

You could also copy the source of Chart::Gnuplot and modify it so that
it does not clean up its files (remove 'CLEANUP => 1' or replace it
with 'CLEANUP => 0' ).

If you can get the file, does it have the string 'noenhanced' in line
1? If not, then you might have a line-ending problem, where the entire
file is being interpreted as a single line.
There is no reference to noenhanced in /my/ code. There are various bits
in the Gnuplot module that mention it, but noenhanced is the default, so I
don't see why it would work on one and not the other.

Sometimes a program will explicitly set a variable to its default
value, just for the sake of explicitness. Sometimes it is to override a
previous, non-default value. Several items can be 'enhanced', so you
don't know which one is being used unless you can inspect the plot
file.
The only possibly relevant difference I can spot is that the working copy
uses gnuplot 4.2 patchlevel 3, the not-working uses 4.0 patchlevel 0

That is a pretty significant difference. Is there any chance you can
upgrade the non-working system to version 4.2?

To help you more, we would need to see some code and information about
versions: Perl, Chart::Gnuplot, etc.
 
V

Vicky Conlan

According to said:
Did you look in directory /tmp/2sp97fafGp for a file called plot? If

Yeah, first thing I checked, there is pretty much nothing in /tmp/. I
assumed it cleaned it up on exit. (I did wonder if /tmp/ wasn't writable,
it looks so empty, but it appears to be ok)
you look at the source of Chart::Gnuplot:

(<http://search.cpan.org/src/KWMAK/Chart-Gnuplot-0.06/lib/Chart/Gnuplot.
pm>),

it looks like it creates a file of that name containing commands to
gnuplot. Some of those commands, such as 'title' or 'set xlabel' can
contain the string 'noenhanced'. The question is why the string
'noenhanced' is being interpreted as a variable.

Yeah, I had a look, but I was hoping (in that "someone has probably done
it before" way the world of Perl is :) I may not have to delve too far
into the guts of it.
You could also copy the source of Chart::Gnuplot and modify it so that
it does not clean up its files (remove 'CLEANUP => 1' or replace it
with 'CLEANUP => 0' ).

That's a good idea.
If you can get the file, does it have the string 'noenhanced' in line
1? If not, then you might have a line-ending problem, where the entire
file is being interpreted as a single line.

It's very odd.
Sometimes a program will explicitly set a variable to its default
value, just for the sake of explicitness. Sometimes it is to override a
previous, non-default value. Several items can be 'enhanced', so you
don't know which one is being used unless you can inspect the plot
file.

Yeah. I just don't get why one copy would be working differently to the
other.
That is a pretty significant difference.

True, but it's a gnuplot difference, not a Perl difference, and the error
struck me as a Perl error not a gnuplot one. But actually, you're right, it's
a gnuplot error. *slaps forehead*
Ok, it may be time for me to go bark up a different tree.
Is there any chance you can
upgrade the non-working system to version 4.2?

I asked for the later version to be installed and they've put it into a
different path (with the existing one remaining where it is), so I'll have
to work out how to convince Chart::Gnuplot to look on a different path for
the executable.
To help you more, we would need to see some code and information about
versions: Perl, Chart::Gnuplot, etc.

Versions are consistent between the two machine, Perl 5.8.8 and
Chart::Gnuplot 0.05

The only difference does seem to be the gnuplot version, which I'd dismissed
as irrelevant, but I'll see if I can prod the module to find the newer version

Thanks for the ideas.
--
 
T

taiwai

I've got a little bit of a problem. I'm not sure if I'm doing something
daft or if I've got a bad installation, but because I don't have any control
over the install I'm having trouble telling what is wrong.

So I've got a fairly simple script which I developed on a freeBSD machine
whilst I waited for the install on the machine at work. It is fairly basic,
it has a couple of datasets, blah blah, then it draws some filled curves.
And it works fine. (output:http://comps.org/fig/simple.png)

Then I tried exactly the same code on a solaris 10 zone and got the ever-
so-unhelpful error:

"/tmp/2sp97fafGp/plot", line 1: undefined variable: noenhanced

There is no reference to noenhanced in /my/ code. There are various bits
in the Gnuplot module that mention it, but noenhanced is the default, so I
don't see why it would work on one and not the other.

The only possibly relevant difference I can spot is that the working copy
uses gnuplot 4.2 patchlevel 3, the not-working uses 4.0 patchlevel 0

Any chance anyone has experienced this and can give me some subtle hints
about what could be the problem? (thanks)

--

Hi,

I read the discussion in another forum (http://www.1-script.com/forums/
Chart-Gnuplot-problem-article104335--6.htm). I know that your system
has two versions of Gnuplot installed. You can tell Chart::Gnuplot
which one to use by the option "gnuplot", e.g.

$chart = Chart::Gnuplot->new(
gnuplot => "/usr/bin/gnuplot-4.2.3",
......
);

The filename of the temp file (i.e. "/tmp/2sp97fafGp/plot") is saved
in "$chart->{_script}". If you want to get the Gnuplot command file,
you may copy "$chart->{_script}" to another file after "$chart->plot2d
(...)".

Hope these help.
 
V

Vicky Conlan

According to said:
I read the discussion in another forum (http://www.1-script.com/forums/
Chart-Gnuplot-problem-article104335--6.htm). I know that your system
has two versions of Gnuplot installed. You can tell Chart::Gnuplot
which one to use by the option "gnuplot", e.g.

$chart = Chart::Gnuplot->new(
gnuplot => "/usr/bin/gnuplot-4.2.3",
......
);

Ah, excellent, I've not had a chance to look it up yet (away from work
for Christmas, etc) so you've saved me a job.
The filename of the temp file (i.e. "/tmp/2sp97fafGp/plot") is saved
in "$chart->{_script}". If you want to get the Gnuplot command file,
you may copy "$chart->{_script}" to another file after "$chart->plot2d
(...)".

Lovely. Both replies to my desperation are now due a pint (redeemable if
I ever turn up at another LPM meet, or if anyone ever codes up "IOweYouA
Pint.com" :-D

Happy Christmas, etc.

--
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top