On Oct 22, Bee said:
>I am just about to study about tie, and I've made a very simple test, but
>don't know what's wrong, would anyone please to point out ?
>
># Mask
>package Mask;
>
>sub TIEHANDLE { my $x; bless \$x; shift }
>sub PRINT { $_ = $$_[0]; s/./*/g; print}
Your TIEHANDLE routine is slightly broken. You want
bless \$x, shift
instead of
bless \$x; shift
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;
}
That should work (I didn't test it, though).
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>