[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...