I'm trying to use Filter::Handle in a script I'm writing (it does exact what I want I need) and see that its tests have been segfaulting on Perl 5.8+. Perl 5.6 seems uneffected. The problem lies in this test for the Filter and UnFilter methods:
my $out;
Filter \*STDOUT, sub {
$out = sprintf "%d: %s\n", 1, "@_";
()
};
print "Foo";
UnFilter \*STDOUT;
print $out eq "1: Foo\n" ? "ok 3\n" : "not ok 3\n";
Here is the code to those two methods:
sub Filter {
my $fh = $_[0];
tie *{ $fh }, __PACKAGE__, @_;
}
sub UnFilter {
my $fh = shift;
{ local $^W = 0; untie *{ $fh } }
}
Perl's internals are not my forte so I don't see or understand what is going wrong. I was hoping someone here could clue me in. The maintainer of the module has his hands full with a few other things right now.
Thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.