in reply to Re: Re (tilly) 1: overloading the print function (or alternatives)
in thread overloading the print function (or alternatives)
as a debugging aid. (The messsage should show up in your webserver's logs.) The following (untested) code is much nicer:print STDERR "Called node 'foo'\n";
and elsewhere in the code:package noprint; use Carp; sub PRINT { my $msg = Carp::longmess("You must return rather than print"); print "Content-type: text/plain\n\n$msg"; die $msg; } *PRINTF = *PRINT; sub TIEHANDLE { return bless ({}, shift); }
That catches the newbie error. Without the potential for headaches that overriding print causes.tie(*NOPRINT, 'noprint'); select(NOPRINT); # time passes while the page is built. # Before spitting out the final page: select(STDOUT);
|
|---|