I have a 98%-XS tied hash class. The only Perl part is the "new"
method used in lieu of tie:

sub new
{
    my $class = shift;
    my $hash = {};

    bless $hash, $class;
    tie %$hash, $class;

    $hash;
}

However, the value that is passed in to tied methods is different than
that passed in to "normal" methods. A trace using printf gave me:

TIEHASH end: 0x080ca6d4
RPM::Database=HASH(0x80ca53c)
FETCH: 0x080ca6d4
XS: 0x080ca53c

The fourth line is from a normal method. The first is the exiting
value of the TIEHASH implementation, the third is a INIT: printf of
self at the top of the FETCH XS block. Line 2 is the result of
"$D = new RPM::Database; print $D". And line 4 is the printf of self
in the method mentioned earlier.

Thus, the value being passed to normal methods matches that of the
external representation of the object. But the tie-related methods
seem to be getting an extra level of indirection. In all routines, the
value of self is derived from the same entry in the typemap file.

Randy
--
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Randy J. Ray                                                    [EMAIL PROTECTED]
Campbell, CA                                                      [EMAIL PROTECTED]
<A HREF="http://www.svsm.org">Silicon Valley Scale Modelers</A>

Reply via email to