leriksen has asked for the wisdom of the Perl Monks concerning the following question:
Filter::Handle is a neat little module I use to cache large blocks of dynamically generated output, that may be needed again with just a few small changes. Specifically, I have a program that generates markup (not HTML, but specific to the print industry) for several hundred thousand statements to customers. These document are generated via some very expensive DBI calls, so if a document is 'almost right' I use some perl code to rejig on the fly rather than spend time doing another DBI call. Filter::Handle intercepts our prints of these documents to the output file handle, and places them in an array. Once the document is generated, multiple copies and variations are created from the captured array, and then all the output happens in one big, seemingly quite efficient, burst. We did this because our first test with multiple DB calls took 12 days to run, not good when you have a weekly print cycle.
But to the issue with Filter::Handle - we use version 0.03, which hasn't changed in over 3 years. tests 3 and 4 tie \*STDOUT to Filter::Handle, with an anonymous sub sprintf'ing the print args to a string. This string has its contents tested after untie'ing STDOUT. For some reason, the print seems to go resursive. I have verified this on both Linux and Solaris, both running Perl 5.8.1
Filter::Handle does a lot of work with typeglobs and packages, and it is a really good study for getting these under your belt.
I have narrowed the problem down to the Filter::Handle::PRINT sub. Previously, this called 'the real print' but now it recurse's to itself and calls Filter::Handle::PRINT again - but I dont understand why the behaviour has changed. I tried things like &main::print to force the 'right' behaviour, so that we call the 'right' print, but no joy - do the functions listed in chapter 3 of the Camel book live in a namespace ??
Does anyone have clue about why this is happening - what could have changed in 5.8.1 to break this so badly ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filter ::Handle segfaults 5.8.1
by ysth (Canon) on Nov 17, 2003 at 08:48 UTC | |
by leriksen (Curate) on Nov 17, 2003 at 09:05 UTC | |
by ysth (Canon) on Nov 17, 2003 at 09:56 UTC | |
|
Re: Filter ::Handle segfaults 5.8.1
by ysth (Canon) on Nov 17, 2003 at 17:01 UTC | |
by leriksen (Curate) on Nov 17, 2003 at 23:30 UTC | |
|
Re: Filter ::Handle segfaults 5.8.1
by sth (Priest) on Nov 17, 2003 at 14:33 UTC | |
by leriksen (Curate) on Nov 17, 2003 at 23:19 UTC |