in reply to passing values from perl to unix app and getting result from the app

Is there a way to pass values to unix app and get results from the app?

My first thought is to use IPC:Open3

A simple example:

#!/usr/bin/perl use warnings; use strict; use IPC::Open3; #interface to "units" calculator #my $pid = open3(\*WRITE, \*READ, \*ERROR,"units -t"); #terse output my $pid = open3(\*WRITE, \*READ, 0 , "units -t"); #if \*ERROR is set to 0, STDERR is sent to STDOUT #chomp(my $prompt = <READ>); #print "$prompt\n"; foreach ( '100 yards', '1 mile', '1 kilometer', '1 parsec', '1 foobar' +){ print WRITE "$_\n meters \n"; chomp(my $answer = <READ>); print "$_ = $answer meters\n"; } __END__

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re: passing values from perl to unix app and getting result from the app
  • Download Code

Replies are listed 'Best First'.
Re^2: passing values from perl to unix app and getting result from the app
by LanX (Saint) on Jun 05, 2014 at 14:53 UTC
    Don't bother! :)

    He shortly revealed (and deleted the update later again) that its about a CA tool and salva already gave him a link to the Perl API.

    Cheers Rolf

    (addicted to the Perl Programming Language)