Re: Pipe and Par questions




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]
.



Relevant Pages

  • Pipe and Par questions
    ... It involved having Perl start other programs ... Gnuplot information directly using a Pipe have not been successful. ... Commands I tried are different variations of: ... Has anyone worked with the PAR module to create .exe programs? ...
    (comp.lang.perl.misc)
  • Re: A _Bunch_ of Article_XXXX commands in _One_ send buffer.
    ... Speaking of perl... ... I love macros, they remove a lot of redundancy and other ugliness. ... issuing Article_XXXX commands one at a time. ... Terminals have a baud rate, ...
    (news.software.readers)
  • Re: Interactive apps with tcl
    ... I am trying to build an interactive test application. ... would like to generate interactive commands to an existing ... I think you will want to look at the Expect extension to Tcl. ... If you prefer to work in Perl, ...
    (comp.lang.tcl)
  • RE: Non-printing Characters
    ... Subject: Non-printing Characters ... commands sent to the printer. ... You've got Perl! ... somefile | less' to see what I can see of a file's format. ...
    (perl.beginners)
  • Re: Difference between Cygwin and DOS handling of string input
    ... Ton of userland tools that make work possible (perl, sed, awk, grep, ... cmd.exe is a shell in that it's a TTY that lets you run commands, ...
    (comp.lang.c)