Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: PERL?

RE: PERL?

From: Daniel Hanks <hanksdc_at_about-inc.com>
Date: Tue, 09 Dec 2003 13:29:26 -0800
Message-ID: <F001.005D9525.20031209132926@fatcity.com>


On Tue, 9 Dec 2003, Yong Huang wrote:

> Speaking of Perl versus shell, Perl may still be quite primitive in supporting
> two-way communication with an external program e.g. sqlplus. (I have an example
> at www.stormloader.com/yonghuang/computer/OracleAndPerl.html#2waytosqlplus
> using IPC::Open2). But I think a KornShell coprocess (not a here document) does
> it nicely, i.e. piping a SQL command in and reading the result back, piping
> another command in, reading again, without exiting your sqlplus session. If you
> use Perl DBI (or the old OraPerl), Jared may know this but I'm not sure if you
> can send any arbitary SQL command such as explain plan, shutdown... and read
> its output.

I think Perl with Expect.pm could likely do this without much effort. Expect allows you to interact with just about anything that uses a terminal. One fun case comes to mind. We have this LED sign (think large rectangular array of LEDs), with an undocumented serial interface protocol. All that came with it to control it was this old DOS program which would talk to the sign over a serial port. So I whipped up a Perl script which used Expect to interact with dosemu (a Linux DOS emulator) to run the program, which interacted with the sign, all running on Linux. Works pretty good.

Expect.pm is also nice to interact with network hardware that offers telnet/shell command interfaces. Interacting with sqlplus via Expect.pm would be pretty easy as well, I would think. It basically works like this:

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Dec 09 2003 - 15:29:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US