Help for this page

Select Code to Download


  1. or download this
    my $out;
    Filter \*STDOUT, sub {
    ...
    print "Foo";
    UnFilter \*STDOUT;
    print $out eq "1: Foo\n" ? "ok 3\n" : "not ok 3\n";
    
  2. or download this
    sub Filter {
        my $fh = $_[0];
    ...
        my $fh = shift;
        { local $^W = 0; untie *{ $fh } }
    }