The method system ("wzzip.exe >NUL: 2>&1"); works on my system.
Here is what I had done:
put together a tiny perl program called "JunkOutput.pl":
-----------------------------------
print STDOUT "this is stdout\n";
print STDERR "this is stderr\n";
-----------------------------------
Then, to experiment with capturing the output, put together
this:
-----------------------------------
print "***Start system - straight\n";
system("JunkOutput.pl");
print "***End\n\n";
print "***Start system - double redirect\n";
system("JunkOutput.pl >NUL: 2>&1");
print "***End\n\n";
print "***Start backticks\n";
`JunkOutput.pl`;
print "***End\n\n";
-----------------------------------
Here is the output:
-----------------------------------
***Start system - straight
this is stdout
this is stderr
***End
***Start system - double redirect
***End
***Start backticks
this is stderr
***End
-----------------------------------
Double redirect is the winner :)
HTH
Eugene Haimov
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Craig
B. Nakata
Sent: Friday, June 25, 2004 1:09 AM
To: ActivePerl
Subject: Re: STDOUT problem
Petr,
Have you tried redirecting STDERR also, the Copyright is probably coming
from STDERR, try:
system ("wzzip.exe >NUL: 2>&1");
I believe the "system" command uses bash as its shell to execute
commands.
Hope this helps.
Craig
Petr Vileta wrote:
> Output to null device not resolve my problem. External program is
> wzzip.exe, the command line utility for Winzip. I don't know how it do
> it, but "wzzip something >nul" still show a Copyright info from
> program :-)
>
> Petr Vileta, Czech republic
>
> ----- Original Message -----
> From: "Haimov, Eugene" <[EMAIL PROTECTED]>
> To: "Petr Vileta" <[EMAIL PROTECTED]>; "ActivePerl"
> <[EMAIL PROTECTED]>
> Sent: Friday, June 25, 2004 1:40 AM
> Subject: RE: STDOUT problem
>
>
>
>>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
>
_______________________________________________
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