[Melbourne-pm] overloading 'print'

Mathew Robertson mathew.robertson at netratings.com.au
Thu Mar 16 21:33:53 PST 2006


Hi folks,

I have a situation where I would like to overload the 'print' and 
'printf' functions, so that I can do some translation stuff in them.  I 
would have expected something like this to work:

*print = sub {
   CORE::print "BLAH> ", $@;
};


or

sub PRINTF {
  CORE::printf "BLAH> ", $@;
}
*printf = \&PRINTF;


So that when I do:
  ...
  print "This is some text";
  ...

I get the output:

  BLAH> This is some text


Does anone know how to overload 'print'?

thanks
Mathew


More information about the Melbourne-pm mailing list