How do I capture output from a print command 
Author Message
 How do I capture output from a print command

Quote:

>I use perl4.

Then you are on your own.

--
    Tad McClellan                          SGML consulting

    Fort Worth, Texas



Wed, 18 Jun 1902 08:00:00 GMT  
 How do I capture output from a print command
Hi,

How do I capture the out put from the print
command.  I would prefer capture it directly not
from a file.  I use perl4.

$var="blah";
open(PIPE, "|cmd");
print PIPE,"$var";

I have tried $out=print ... to no avail.

Thanks.
Andrew.

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 27 May 2003 08:37:56 GMT  
 How do I capture output from a print command


I can not believe perl4 can not do this ?  amazing !!!???
Andrew

Quote:

> >I use perl4.

> Then you are on your own.

> --
>     Tad McClellan                          SGML consulting

>     Fort Worth, Texas

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 30 May 2003 09:46:58 GMT  
 How do I capture output from a print command

Quote:

>> >I use perl4.


>> Then you are on your own.

>I can not believe perl4 can not do this ?  amazing !!!???

"You are on your own" doesn't mean "perl can't do it".  It means "you
are on your own", as in perl 4 is really out of date, and nobody is
interested in helping people with it.

  - Logan



Fri, 30 May 2003 10:41:48 GMT  
 How do I capture output from a print command

Quote:

>I can not believe perl4 can not do this ?  amazing !!!???

It can't.

I'd suggest using the tie mechanism, to tie the output handle to
whatever you want to do with the output (for example, appending to a
variable), but tie is an addition in Perl5.

Using Unix, your can use all sorts of fork/pipe tricks, but that's Unix,
not Perl. Since I'm in no way a Unix guru, I won't even make an attempt
in that way.

--
        Bart.



Fri, 30 May 2003 17:39:01 GMT  
 How do I capture output from a print command

++
++
++ Using Unix, your can use all sorts of fork/pipe tricks, but that's Unix,
++ not Perl.

But Perl is hardly anymore than a wrapper around the Unix API....

Abigail



Sat, 31 May 2003 04:44:05 GMT  
 How do I capture output from a print command
On Fri, 08 Dec 2000 00:37:56 GMT,

Quote:
> Hi,

> How do I capture the out put from the print
> command.  I would prefer capture it directly not
> from a file.  I use perl4.

That severely limits the possibilities, and it reduces your hopes for
support from here to almost nil. Most people here have forgotten too
many things about Perl 4.

Quote:
> $var="blah";
> open(PIPE, "|cmd");
> print PIPE,"$var";

> I have tried $out=print ... to no avail.

What do you mean 'capture output from the print command'? You print to
a file handle, and the output ends up in a file. You print to a
socket, and the output ends up at the reader on the other end. print
where you want to print.

In Perl 5 you could use tied handles. Depending on what you mean, a
reopen of the handle to something else might be what you want:

open(STDOUT, ">some_file") ||
        die "Cannot reopen STDOUT to some_file: $!"

Is what you are really saying that you have an external program, and
you want to write to it as well as read from it? Perl 5 has
IPC::Open2, and I seem to recall that Perl 4 shipped with a library
called open2.pl. I think maybe that is what you want.

Now, please, if you insist on continuing to use a perl version that
has been dead since 1995, then also accept that you are on your own.
get yourself an old copy of the Camel (Programming Perl), and maybe
some other old books, but don't expect people here to know much about
it anymore.

Just get with the times, and get Perl 5

Martien
--
Martien Verbruggen              |
Interactive Media Division      | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd.   | crops where there ain't no crops.
NSW, Australia                  |



Sat, 31 May 2003 06:00:01 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. capturing command line error or output from `<command>`

2. capturing output of FILEHANDLE "| command"

3. capturing output from a remote command (how?)

4. Capturing System Command Output with Perl on Windows/Apache

5. capturing output of executed system command

6. capturing output of piped commands

7. Help with Piped command, capturing output

8. Capture command output into list?

9. Capturing output of a system command

10. help with capturing output of open command

11. Capturing command output in Perl

12. Capturing Command Line Output

 

 
Powered by phpBB® Forum Software