Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Hey Jonathan, can this work in Win32 environment?
[color=Black]Yeah, I called you out on this one. :-)
I'm trying to redirrect STDERR to a file in a perl script on a Win32 server. But here's the kicker, I need to associate the line number in the script where the error occured...
I know hoe to redirrect STDERR:[/color]
[color=Blue][code]open(SAVE_STDERR, ">&STDERR") or die "Failed to save STDERR: $!";
open(STDERR, ">", "$logfile") or die "Failed to re-direct STDERR to '$logfile': $!";[/code][/color]
I also know of the method of capturing a commands STDERR, but I am not sure if this would work from within the script capturing STDERR's from processes called inside the script such as:
[code][color=Blue]$pid = open(PH, "[b]&run_this( $cmd )[/b] 2>&1 1>/dev/null |"); [/color][/code]
I know I need to some how be able to step through it kind of like the perl interpretor does when we 'use warnings' I guess..?
Could this be done from within the same script?
Any suggestions and/or ideas would be greatly appreciated...