<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>The main point of the exercise was so that I could do something
like:<br>
<br>
&nbsp;use MyPrint;<br>
&nbsp;print "Blah";<br>
<br>
which outputs:<br>
<br>
&nbsp;MyPrint: Blah<br>
<br>
rather than:<br>
<br>
&nbsp;Blah<br>
<br>
The purpose being that I simply want to delete the 'use MyPrint;' line
to restore the normal Perl behaviour.<br>
Using IO::Wrap doesn't give that as I would have to change the syntax
to:<br>
<br>
&nbsp;use IO::Wrap;<br>
&nbsp;no warnings;<br>
&nbsp;sub IO::Wrap::print {<br>
&nbsp;&nbsp; my $self = shift;<br>
&nbsp;&nbsp; print { $$self } "IO::Wrapped: ", @_;<br>
&nbsp;}<br>
&nbsp;use warnings;<br>
&nbsp;wraphandle(\*STDOUT);<br>
&nbsp;print "Blah";<br>
<br>
or something similar.&nbsp; However, this doesn't override 'print' as it
produces the output:<br>
<br>
&nbsp;Blah<br>
<br>
rather than what is wanted:<br>
<br>
&nbsp;IO::Wrapped: Blah<br>
<br>
Hope this explains,<br>
Mathew<br>
</tt><br>
Joshua Goodall wrote:
<blockquote cite="mid20060321235641.GX46507@roughtrade.net" type="cite">
  <pre wrap="">On Wed, Mar 22, 2006 at 10:32:10AM +1100, Mathew Robertson wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Thats an interesting question, and one that I will eventually tackle.   
The whole concept of overriding 'print' itself is fundamentally suspect, 
so I'm specifically trying to *not* allow flexible useage of the package.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
was there a reason you couldn't just create a wrapper class derived
from IO::Wrap or whatever?  The wrapper class could then just munge
the print call on the way through.

depends on your code architecture I guess, but the OO way is nice :)


  </pre>
</blockquote>
</body>
</html>