Re: Pipe and Par questions
- From: Ben Morrow <ben@xxxxxxxxxxxx>
- Date: Mon, 28 Apr 2008 23:34:19 +0100
Quoth "E.D.G." <edgrsprj@xxxxxxxxxxxxx>:
What needs to be done to get Perl 5.10 (and Vista) to send information and
commands directly to a separate program? Perl is being used with
Gnuplot.exe, a versatile and powerful free, downloadable graphics program.
In the past I had Perl store information in a file that Gnuplot checked
several times a second. That worked. But attempts to get Perl to send
Gnuplot information directly using a Pipe have not been successful.
Commands I tried are different variations of:
Open (Program, "| program name");
Print Program 'information', "\n";
This is not valid Perl: Perl is case-sensitive. Please port tha actual
code you have run.
On my machine (5.8.8/i686-freebsd), the following works perfectly:
#!/usr/bin/perl
use warnings;
use strict;
open my $GP, '|-', qw/gnuplot -/
or die "can't run gnuplot: $!";
print $GP <<GP;
plot sin(x)
pause mouse
GP
close $GP or die "writing to gnuplot failed: $!";
__END__
I would expect it to work on yours also: is this not the case?
Perl did not stop running or generate any error messages. But Gnuplot just
waited for commands and did not do anything.
Have you read the gnuplot documentation? You must pass a '-' argument to
get it to read commands from stdin.
The plan is to generate .exe versions of my Perl programs and then circulate
them for free use to other researchers around the world who can download
their own copies of Gnuplot.
Has anyone worked with the PAR module to create .exe programs? Is PAR the
correct module to use? It would be helpful to see the exact commands that
need to be used to generate .exe programs. When I tried to use PAR in the
past I did not have much success.
IME it works very well, especially more recent versions.
Ben
--
You poor take courage, you rich take care:
The Earth was made a common treasury for everyone to share
All things in common, all people one.
'We come in peace'---the order came to cut them down. [ben@xxxxxxxxxxxx]
.
- Follow-Ups:
- Re: Pipe and Par questions
- From: E.D.G.
- Re: Pipe and Par questions
- References:
- Pipe and Par questions
- From: E.D.G.
- Pipe and Par questions
- Prev by Date: Re: Pipe and Par questions
- Next by Date: Pipe and Par questions
- Previous by thread: Re: Pipe and Par questions
- Next by thread: Re: Pipe and Par questions
- Index(es):
Relevant Pages
|