You can also try redirecting your unwanted output to a null-device.
Eugene Haimov

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Petr
Vileta
Sent: Thursday, June 24, 2004 6:22 PM
To: ActivePerl
Subject: Re: STDOUT problem


> Like any other package variable, you can alias STDOUT so that it 
> points to a different FILEHANDLE. While it's aliased anything that 
> would normally go to STDOUT will go to the new FILEHANDLE. Ex.
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> open( FH, '>out' ) or die;
>
> *ORIG = *STDOUT;
> *STDOUT = *FH;
>
> print "hello, world!";
>
> *STDOUT = *ORIG;
>
> __END__

Problem remaining :-( Your code work for perl "print" only but no for
external programs or external program use non standard routines for
output. Please try this part of code

print "<html><body>";
open( FH, '>out' ) or die;
*ORIG = *STDOUT;
*STDOUT = *FH;
system('echo hallo');
*STDOUT = *ORIG;
print "<br>System command was be run</body></html>";

in server script and "run" this in browser eg.
http://somedomain.com/cgi-bin/myscript.pl
You will see

hallo
System command was be run

Maybe not on Linux but on MS-IIS yes :-)
I resolve my problem with this trick

print "<span style=\"display: none\;\">";
system('echo hallo');
print "</span>";

Output from external program still go to browser but for user is not
visible. Have you a better idea?

Petr Vileta, Czech republic

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to