This does for xsutils.c what Graham's patch did for Scalar::Util. Mark Index: xsutils.c --- xsutils.c.orig Mon Apr 10 19:24:55 2000 +++ xsutils.c Mon Apr 10 18:52:12 2000 @@ -253,6 +253,8 @@ rv = ST(0); ST(0) = TARG; + if (SvMAGICAL(rv)) + mg_get(rv); if (!(SvOK(rv) && SvROK(rv))) goto usage; sv = SvRV(rv); End of Patch. On Sat, Apr 08, 2000 at 07:11:45PM -0700, Jason Kirtland wrote: > This is a bug report for perl from jason@desktop.com, > generated with the help of perlbug 1.28 running under perl v5.6.0. > > > ----------------------------------------------------------------- > [Please enter your report here] > > Problem: 'reftype' utilities don't work through ties. > > use Tie::Hash; # Arrays also. > use attributes; > use Scalar::Util; > > tie %Tied, 'Tie::StdHash'; > %Tied = ( ref => {} ); > %Plain = ( ref => {} ); > > print 'P: ', ref($Plain{ref}), "\n"; # HASH > print 'T: ', ref($Tied{ref}), "\n"; # HASH > > print 'P: ', Scalar::Util::reftype($Plain{ref}), "\n"; # HASH > print 'T: ', Scalar::Util::reftype($Tied{ref}), "\n"; # undef > > print 'P: ', attributes::reftype($Plain{ref}), "\n"; # HASH > print 'T: ', attributes::reftype($Tied{ref}), "\n"; # dies: > # Usage: attributes::reftype $reference > > Here's the XS code from Scalar::Util. > > char * > reftype(sv) > SV * sv > PROTOTYPE: $ > CODE: > { > if(!SvROK(sv)) { > XSRETURN_UNDEF; > } > RETVAL = sv_reftype(SvRV(sv),FALSE); > } > OUTPUT: > RETVALThread Previous | Thread Next