Home > Archive > PERL Beginners > August 2005 > Shell output
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Scott Taylor 2005-08-23, 6:56 pm |
|
Hello all,
I have a CGI script that I need to display the output of a shell program,
basically a simple C program that parses some text.
The output is right to the browser, and I don't want it to be creating any
new files or anything. I have a data field that has a blob and that blob
needs to be parsed and the output returned to the browser.
What is a good way to do this:
while ( my ($row ) = $sth->fetchrow_hashref ) {
my $raw_data = $row->{BLOB};
my $parsed_data = system ("echo $raw_data|pasrer");
...
}
of course that doesn't work, but what would be the right way to do it?
Cheers.
--
Scott
| |
| Wiggins d'Anconia 2005-08-23, 6:56 pm |
| Scott Taylor wrote:
> Hello all,
>
> I have a CGI script that I need to display the output of a shell program,
> basically a simple C program that parses some text.
>
> The output is right to the browser, and I don't want it to be creating any
> new files or anything. I have a data field that has a blob and that blob
> needs to be parsed and the output returned to the browser.
>
> What is a good way to do this:
>
> while ( my ($row ) = $sth->fetchrow_hashref ) {
> my $raw_data = $row->{BLOB};
> my $parsed_data = system ("echo $raw_data|pasrer");
> ...
> }
>
> of course that doesn't work, but what would be the right way to do it?
>
> Cheers.
>
> --
> Scott
>
You should have a look at the section "Pipe Opens" in,
perldoc perlopentut
Should be what you are looking for. I do assume you have a good reason
for writing the parser in C....
http://danconia.org
| |
| Scott Taylor 2005-08-23, 9:55 pm |
|
Wiggins d'Anconia said:
> Scott Taylor wrote:
>
> You should have a look at the section "Pipe Opens" in,
>
> perldoc perlopentut
Now I'm really ! LOL
> Should be what you are looking for. I do assume you have a good reason
> for writing the parser in C....
I didn't write it, way beyond me.
Thanks.
--
Scott
| |
| Scott Taylor 2005-08-23, 9:55 pm |
|
Jay Savage said:
> On 8/23/05, Scott Taylor <scott@dctchambers.com> wrote:
>
> Use backticks.
>
> $data = `/path/to/parser $raw_data`
That was easy! Thanks. :)
--
Scott
|
|
|
|
|