Syntactic Confectionery Delight | |
PerlMonks |
Re^3: Errors uncaught by CGI::Carpby Bod (Parson) |
on Oct 15, 2021 at 18:14 UTC ( [id://11137595]=note: print w/replies, xml ) | Need Help?? |
you can redirect your script's STDOUT to an in-memory file in a BEGIN block, then at the END, print the contents of that in-memory variable to a logfile and to the original STDOUT handle I have tried this approach. It is working in the test environment and has been applied to one of the production scripts that I use quite a bit and from which I regularly get 500 errors. And of course, I keep testing and it isn't giving errors...but I am sure it will before long! Here is what the top of the script looks like...
The braces around the first BEGIN and END block are to limit the scope of use autodie; - is that right and is that 'all' they are doing? I can see what print {$fh} ($memory =~ s/^/$prefix/gmr); is doing but could not write it from scratch! The braces are needed because the thing that is printed is being calculated on the fly instead of being a constant or intopolated from a variable - is that right? Thanks for your help thus far...I have a rapidly growing log file capturing all the stuff output to people's browsers. Hopefully somewhere in that lot I will find the clue that unlocks my understanding of the error.
In Section
Seekers of Perl Wisdom
|
|