
unix command displayed when using PIPES with open.
HAHA.... what a day I've had......... sorry Greg.... this must go down as
the
stupidest thing in my professional career....
It's one of those days where you need a second set of eyes to look at your
mistakes........ I was working on something at work when I should have
been
working on other things.... I kept switching between what I was meant to
have been
working on... and getting a little pissed at why it would work.........
I was to busy looking at the open() onwards..... well that's my lame excuse.
Is there any cure for code blindness? If not... I'm finished.
Now I look as stupid as I've been feeling for a while.
Thanks Greg!
Quote:
>> When i execute the following source code, the command being executed
>> by the pipe is being displayed on the screen... how do i stop
>> this from happening.... without re-directing it..... not even to
bit-heaven
>> (/dev/null).... if it's done in C, it doesn't happen.
>Ummm... did you even read your code? There's a 'print "$syscmd\n"' in
>there, you know.
>> #!/usr/bin/perl -w
>> use strict;
>> use 5.004;
>> my( $syscmd ) = "prs -e -d\":M: :I: :D: by :P:\"
$ENV{'PROJECTDIR'}/SCCS/";
Quote:
>> my( $line );
>> print "$syscmd\n";
> ^^^^^
>Right here. Now, why on *earth* would that statement print the value of
>$syscmd followed by a newline? It just doesn't make sense... >smirk<
>> open( FILEPIPE, "$syscmd|" ) or die "Unable To Open Pipe\n";
>> close( FILEPIPE );
>BTW it's a good idea to check $? after closing a pipe -- it's only after
>closing that you find out if the program being spawned wasn't found or
>wasn't executable (or something). 'open' failure usually means
>"couldn't fork" (which you would be able to find out if you had included
>$! in your 'die' after 'open' above).
> Greg
>--
>Corporation for National Research Initiatives
>1895 Preston White Drive voice: +1-703-620-8990 x287
>Reston, {*filter*}ia, USA 20191-5434 fax: +1-703-620-0913