in reply to Re: Re (tilly) 1: overloading the print function (or alternatives)
in thread overloading the print function (or alternatives)

Then you would mess up someone who had inserted:
print STDERR "Called node 'foo'\n";
as a debugging aid. (The messsage should show up in your webserver's logs.) The following (untested) code is much nicer:
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); }
and elsewhere in the code:
tie(*NOPRINT, 'noprint'); select(NOPRINT); # time passes while the page is built. # Before spitting out the final page: select(STDOUT);
That catches the newbie error. Without the potential for headaches that overriding print causes.