[Pdx-pm] Even more inline testing
Kris Bosland
krisb at ring.org
Fri Jun 17 14:34:20 PDT 2005
Say, the wacky filehandle tying you are doing in pod2test*, does
that work on Win32 perl? I would like to capture test results from the
inline test I am working on so I can massage them before printing.
Thanks.
-Kris
* e.g.
package Catch;
sub TIEHANDLE {
my($class, $var) = @_;
return bless { var => $var }, $class;
}
sub PRINT {
my($self) = shift;
${'main::'.$self->{var}} .= join '', @_;
}
sub OPEN {} # XXX Hackery in case the user redirects
sub CLOSE {} # XXX STDERR/STDOUT. This is not the behavior we want.
sub READ {}
sub READLINE {}
sub GETC {}
sub BINMODE {}
my $Original_File = '%s';
package main;
# pre-5.8.0's warns aren't caught by a tied STDERR.
$SIG{__WARN__} = sub { $main::_STDERR_ .= join '', @_; };
tie *STDOUT, 'Catch', '_STDOUT_' or die $!;
tie *STDERR, 'Catch', '_STDERR_' or die $!;
More information about the Pdx-pm-list
mailing list