HI
i ve got a third party DB. Fo that DB have no drivers at all.
But have sql utilities
i want to run tis command from perl script and parse output.
when i use just open
my $sql = "select * from users";
open (COMMAND, "| /opt/sql " ) || die $!;
print (COMMAND "connect credentials")
print (COMMAND "$sql\n");
output fine
--> 4, 4, Reporting, , F, 1, 0, 0, 0, 0, 0, F, 0, F, 0, F, , BLOB(0)
But when i use just open i can't grab output of $sql command (just in terminal).
When i use open2 (and 3 too)
my $sql = "select * from users";
my $pid = open2 (OUT, IN, "/opt/sql") || die $!;
print (IN "connect credentials");
print (IN "$sql\n");
while (<OUT>) {
print $_;
}
I've got almost same output but have ">"
--> 4, >4, Reporting, , F, 1, 0, 0, 0, 0, 0, F, 0, F, 0, F, , BLOB(0)
I guess this trouble in terminal environment (but maybe and not). Can anyone tell me can i grab clear output in this is situation?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.