in reply to Tieing a local filehandle
If your on 5.8.1 (from memory), you can skip using IO::Scalar completely and using teh new form of open to a scalar (which means $/ is honoured correctly).
#! perl -slw use strict; my $x; { local *STDERR; open STDERR, '>', \$x or die "STDERR $!"; print STDERR 'stuff'; warn 'Sommats up!'; } print STDERR 'More stuff'; print "Caught: $x"; __END__ P:\test>381308 More stuff Caught: stuff Sommats up! at P:\test\381308.pl line 9.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tieing a local filehandle
by etcshadow (Priest) on Aug 09, 2004 at 18:15 UTC |