in reply to How to capture Net::SFTP::Foreign output
#!/usr/bin/perl use warnings; use strict; open my $olderror, ">&STDERR" or die "Can't dup STDERR: $!"; open STDERR, ">&STDOUT" or die "Can't dup STDOUT: $!"; warn "This is sent on STDOUT\n"; open STDERR, ">&", $olderror or die "Can't dup \$olderror: $!"; warn "This is sent on STDERR\n";
Note STDERR, like all bareword filehandles, is global in scope and so you might be messing in someone else's backyard. Note as well you'll probably want to restore the channel, as I have, when you are done with it.
|
|---|