> >
> > And your PRINT method is wrong.  The first argument is the object (which
> > you don't need) and the second argument is the string being printed.
> >
> >   sub PRINT {
> >     local $_ = $_[1];
> >     s/./*/g;
> >     print;
> >   }
>

> but I am regret to tell that I still can't print. and I even can't do
> anything
> inside this block. Just simply
>
> print "."
>
> My shell got crash. Anything I print from this block, Windows will shut it
> down and tell there is an error, What happen ?!
>

Finally, I changed my sub like this :

package TryTie;
sub TIEHANDLE { my $x; bless \$x, shift  }
sub PRINT { print STDERR $_[1] }
1;

and my script don't halt anymore ( that must be ),  and I got what I want to
print. But I believe that's a big cheat ! I just use STDOUT to be a trap,
and
use STDERR to work... So what happen to my STDOUT ? Did I missed
something in my main script ?

use TryTie;
tie *STDOUT, 'TryTie' or die "Can't tie";
print 123;

A little bit more, so what is Tie::Handle doing ? I already read through
perldoc perltie,
perdoc -m Tie::Handle and
perldoc -f tie

Do I require to read some more to understand how tie works and what's
going on if I tie my STDOUT ? Note, I am on Win2K.

Please please give me some idea, thanks,
Bee



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to