develooper Front page | perl.perl5.porters | Postings from April 2000

[ID 20000408.001] 'reftype' does not work through ties

Thread Next
From:
Jason Kirtland
Date:
April 8, 2000 19:12
Subject:
[ID 20000408.001] 'reftype' does not work through ties
Message ID:
200004090211.TAA20954@ephedra.jumpdata.com
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:
    RETVAL


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl v5.6.0:

Configured by bbuchanan at Fri Mar 31 12:27:16 PST 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.5-15, archname=i686-linux
    uname='linux penseur.jumpdata.com 2.2.5-15 #1 mon apr 19 23:00:46 edt 1999 i686 unknown '
    config_args='-des -O -Dprefix=/dt/vendor -Dlocincpth=/dt/vendor/include -Dloclibpth=/dt/vendor/lib -Dvendorprefix=/dt/server/perl5 -Dvendorbin=/dt/server/bin -Dvendorscript=/dt/server/bin -Dvendorlib=/dt/server/lib/perl5/5.6.0 -Dvendorman1=/dt/server/man/man1 -Dvendorman3=/dt/server/man/man3 -Dvendor=desktop.com -Dappllib=/dt/islands/lib/perl5 -Dbincompat5005 -Accflags=-DPERL_POLLUTE'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-DPERL_POLLUTE -fno-strict-aliasing -I/dt/vendor/include'
    ccflags ='-DPERL_POLLUTE -fno-strict-aliasing -I/dt/vendor/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/dt/vendor/lib'
    libpth=/dt/vendor/lib /lib /usr/lib /usr/local/lib
    libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=/lib/libc-2.1.1.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/dt/vendor/lib'

Locally applied patches:
    

---
@INC for perl v5.6.0:
    /u/jason/lib/perl
    /dt/islands/lib/perl5
    /dt/vendor/lib/perl5/5.6.0/i686-linux
    /dt/vendor/lib/perl5/5.6.0
    /dt/vendor/lib/perl5/site_perl/5.6.0/i686-linux
    /dt/vendor/lib/perl5/site_perl/5.6.0
    /dt/vendor/lib/perl5/site_perl
    /dt/server/lib/perl5/5.6.0/i686-linux
    /dt/server/lib/perl5/5.6.0
    /dt/server/lib/perl5
    .

---
Environment for perl v5.6.0:
    HOME=/u/jason
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/dt/vendor/lib:/dt/server/lib:/dt/vendor/lib:/dt/server/lib:/dt/vendor/lib:/dt/server/lib:/dt/vendor/lib:/dt/server/lib:/dt/vendor/lib:/dt/server/lib:
    LOGDIR (unset)
    PATH=.:~/bin:/dt/vendor/bin:/dt/server/bin:/usr/etc:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/bin
    PERLLIB=/u/jason/lib/perl
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About