Tom,

Thanks for your suggestion. That worked, albeit partially. Let  me explain:
Here's my original snippet:
---------
    if(open(EXEC_WRITER, "|$executable > $filename"))
    {
      my $cmd;
      foreach $cmd (@commands)
      {
        print  EXEC_WRITER "$cmd\n";
      }
      close EXEC_WRITER ;
      {
        if(open (OUT_PUT, "$filename"))
        {
          my @output_content = <OUT_PUT>;
          $output_string = "@output_content";
          close OUT_PUT;
        }
      }
    }
-----------

With your change of including the 'pipe' in the command, it works from the command line. However, when I run it in a spawned subprocess whose sys$input and sys$output are assigned through mailboxes to the parent process, the perl execution hangs in the line " close EXEC_WRITER ;" above.  Perl seems to be doing a redefinition of sys$input of the subprocess created here to it's own mailbox,  but is unable to close it. I do observe that the subprocess running $executable does complete and goes away, and the $filename output file is created correctly with the expected contents.

Thanks,
Sam



Thomas R Wyant_III wrote:
Sam Ravindhran wrote on 10/24/2004 09:06:49 PM:

  
The following lines of code taken from Unix fails for
me on VMS:
----------------------
    if(open(EXEC_WRITER, "|$executable > $filename"))
    {
    

Snip!

  
I get an error indicating that the ">" character is
invalid in a command line. It looks like there is an
attempt to redirect output to a file ($filename) the
syntax of which fails. Is there a way to recode this
to make it work on VMS or is it possible that I am
missing some patch/fix for this problem? I am using
Perl distribution at version  5.6.
    

  
Appreciate any pointers.
    

  
Thanks,
Sam
    

Yep, that's an error. VMS DCL doesn't work at all the way a UNIX shell 
does, and there's no general solution.

If you're a reasonably recent version of VMS, though, you can try

if(open(EXEC_WRITER, "|pipe $executable > $filename"))

If this doesn't work, your alternatives are more or less ugly:

If your executable supports the "/out=" qualifier, substitute it for the 
">". Otherwise you may have to launch a DCL script to do your dirty work, 
and I'm not sure off the top of my head how you get the assignment for 
sys$input right.

Good luck,
Tom Wyant


This communication is for use by the intended recipient and contains 
information that may be privileged, confidential or copyrighted under
applicable law.  If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited.  Please notify the sender
by return e-mail and delete this e-mail from your system.  Unless
explicitly and conspicuously designated as "E-Contract Intended",
this e-mail does not constitute a contract offer, a contract amendment,
or an acceptance of a contract offer.  This e-mail does not constitute
a consent to the use of sender's contact information for direct marketing
purposes or for transfers of data to third parties.

 Francais Deutsch Italiano  Espanol  Portugues  Japanese  Chinese  Korean

            http://www.DuPont.com/corp/email_disclaimer.html


  

Reply via email to