Basically, I would like to openconnect to sqlplus using Perl by sending a query and then returning the information from the query.
Current Code:
open(PIPE, '-|', "sqlplus user/password@server_details");
while (<PIPE>) {
print $_;
}
This allows me to go into sqlplus and execute my query.
I'm having trouble figuring out how to pass a sqlplus query to Perl (since it's always the same query), and once that is done, how can I get the information written back to the variable in my Perl script?
PS - I know about DBI... but I would like to know how to do this using the above method, as inelegant as it is :)
, sqlplus, ... , .
my $squery = "select column from table where rownum <= 10;"
open(PIPE, '|-', "sqlplus user/password@server_details") or die "I cannot fork: $!";
print PIPE $squery;
STDOUT sqlplus, Perl (parent) script?
, .
:
Perl script (parent) → open pipe sqlplus () → → sqlplus (STDOUT?) → STDOUT Perl script ()
. , sqlplus , DBI. , - ...