comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Calling IDL from Perl
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Calling IDL from Perl [message #26956] Wed, 03 October 2001 13:43 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
You are trying to do interprocess communications the poor man's way,
and you are getting poor man's results. :-)

Here are a couple of suggestions.

One possibility is that the programs run in the order you expect, but
their outputs are flushed to the screen in the wrong order. Both
processes will get access to the same output stream, but the *order*
that they get it is not usually well defined. The solution is for you
to capture the output of IDL within perl, and then print them from
within perl.

Another thing to try is to send all of your commands to IDL at once.
Ie, build up a list of commands, including "exit", and dump those out
to the IDL session when you open it.

Finally, you could send all those commands to a "file.pro" and then
start IDL by calling on the command line "idl file.pro".

Do these help?
Craig


gary.hodgesREMOVE@cires.colorado.edu writes:
> OK, I have distilled my problem down to the simplest example I can. My
> problem is that the Perl script finishes before the IDL script is executed.
> I have tried sleep commands, but the results are the same. What can I do to
> get the IDL script to execute before the Perl script prints the contents of
> @ary? Below are the two scripts and the output.
>
> Cheers,
> Gary
>
>
> #!/usr/bin/perl
> open(IDL, "|/usr/local/bin/idl");
> print IDL ".Compile loop \n";
> print IDL "loop \n";
> @ary=(5,6,7,8);
> for (@ary) {
> print "$_\n";
> }
> ----------------------------------
> PRO LOOP
> FOR j=1,4 DO BEGIN
> Print, j
> ENDFOR
> END
> ==================================
> The output when I run the Perl code is:
>
> phoenix> perl loop.pl
> 5
> 6
> 7
> 8
> phoenix> IDL Version 5.4 (sunos sparc). (c) 2000, Research Systems, Inc.
> Installation number: 100780-40.
> Licensed for use by: OAR/ARL:Chris Cornwall:SUN100
>
> % Compiled module: LOOP.
> 1
> 2
> 3
> 4
>
>

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: right-justifying draw widgets?
Next Topic: Re: Is there a line widget

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 23:50:44 PDT 2025

Total time taken to generate the page: 0.71923 seconds