capture stdin and stderr

2007-03-20 Thread Vladimir Lemberg
Hi All,

 

My script is calling a Win32 program with two arguments:

system ( $ARGV[0]\\program.exe, $File::Find::name, $ARGV[0]\\source);

 

I want to capture STDOUT and STDERR from the program to log file

 

system ( $ARGV[0]\\program.exe, $File::Find::name, $ARGV[0]\\source, 
1$ARGV[0]\\log.txt, 21 );

 

Compiler gave me syntax error. And for sure the problem with this part: 
1$ARGV[0]\\log.txt, 21.

I was trying to double quote it and put commas but it didn't help.

Is there any way to accomplish this task under Win32 environment?

Thanks in advance,
Vladimir

RE: capture stdin and stderr

2007-03-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
 -Original Message-
 From: Vladimir Lemberg [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, March 20, 2007 15:21
 To: beginners@perl.org
 Subject: capture stdin and stderr
 
 Hi All,
 
  
 
 My script is calling a Win32 program with two arguments:
 
 system ( $ARGV[0]\\program.exe, $File::Find::name, 
 $ARGV[0]\\source);
 
  
 
 I want to capture STDOUT and STDERR from the program to log file
 
  
 
 system ( $ARGV[0]\\program.exe, $File::Find::name, 
 $ARGV[0]\\source, 1$ARGV[0]\\log.txt, 21 );
 
  
 
 Compiler gave me syntax error. And for sure the problem with 
 this part: 1$ARGV[0]\\log.txt, 21.
 
 I was trying to double quote it and put commas but it didn't help.
 
 Is there any way to accomplish this task under Win32 environment?
If using ActiveState, then see perlfaq8 and header How can I
capture STDERR from an external command?

If not AS, then reply back and I can that portion of the doc.
 
 Thanks in advance,
 Vladimir
 

**
This message contains information that is confidential and proprietary to FedEx 
Freight or its affiliates.  It is intended only for the recipient named and for 
the express  purpose(s) described therein.  Any other use is prohibited.
**


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: capture stdin and stderr

2007-03-20 Thread Vladimir Lemberg

Hi David,

Would you please send this portion to me?

Thanks,
Vladimir

- Original Message - 
From: Wagner, David --- Senior Programmer Analyst --- WGO 
[EMAIL PROTECTED]

To: Vladimir Lemberg [EMAIL PROTECTED]; beginners@perl.org
Sent: Tuesday, March 20, 2007 3:54 PM
Subject: RE: capture stdin and stderr



-Original Message-
From: Vladimir Lemberg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 20, 2007 15:21
To: beginners@perl.org
Subject: capture stdin and stderr

Hi All,



My script is calling a Win32 program with two arguments:

system ( $ARGV[0]\\program.exe, $File::Find::name,
$ARGV[0]\\source);



I want to capture STDOUT and STDERR from the program to log file



system ( $ARGV[0]\\program.exe, $File::Find::name,
$ARGV[0]\\source, 1$ARGV[0]\\log.txt, 21 );



Compiler gave me syntax error. And for sure the problem with
this part: 1$ARGV[0]\\log.txt, 21.

I was trying to double quote it and put commas but it didn't help.

Is there any way to accomplish this task under Win32 environment?

If using ActiveState, then see perlfaq8 and header How can I
capture STDERR from an external command?

If not AS, then reply back and I can that portion of the doc.


Thanks in advance,
Vladimir



**
This message contains information that is confidential and proprietary to 
FedEx Freight or its affiliates.  It is intended only for the recipient 
named and for the express  purpose(s) described therein.  Any other use is 
prohibited.

**


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: capture stdin and stderr

2007-03-20 Thread Mumia W.

On 03/20/2007 05:21 PM, Vladimir Lemberg wrote:

Hi All,

 


My script is calling a Win32 program with two arguments:

system ( $ARGV[0]\\program.exe, $File::Find::name, $ARGV[0]\\source);

 


I want to capture STDOUT and STDERR from the program to log file

 


system ( $ARGV[0]\\program.exe, $File::Find::name, $ARGV[0]\\source, 
1$ARGV[0]\\log.txt, 21 );
[...]


Even on a *nix system, this wouldn't work because redirection requires 
the shell, and the system PROGRAM LIST method of starting programs 
doesn't use the shell.


Look into IPC::Open3:
Start-Run-perldoc IPC::Open3

Get more information about Perl:
Start-Run-perldoc perl



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/