develooper Front page | perl.perl5.porters | Postings from August 2001

[ID 20010806.006] Can't read coderef from tied variable

Thread Next
From:
Anno Siegel
Date:
August 6, 2001 04:20
Subject:
[ID 20010806.006] Can't read coderef from tied variable
Message ID:
200108061119.LAA15554@lublin.zrz.TU-Berlin.DE
This is a bug report for perl from anno4000@lublin.zrz.tu-berlin.de,
generated with the help of perlbug 1.33 running under perl v5.6.1.


-----------------------------------------------------------------
Returning a coderef from a tied variable doesn't trigger the FETCH
method in the tying package.  I see the same result in 5.7.2.
Further observations and workaround available.

Anno

--------------Demo code-------------------------
#!/usr/bin/perl
#!/usr/src/perl/bleedperl/perl-5.7.2/perl
use warnings; use strict; $| = 1;

tie my $tied, 'TieCode';
$tied = 1234;
my $back = &$tied;
print "got back: $back\n";

package TieCode;

sub TIESCALAR {
    bless \ my ( $self), shift;
}

sub STORE {
    print "storing $_[1]\n";
    ${ $_[0]} = $_[1];
}

sub FETCH {
    my $self = shift;
    print "retrieving $$self\n";
    sub { $$self };
}

-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.6.1:

Configured by anno4000 at Tue May  1 02:23:22 MEST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.0.36, archname=i586-linux
    uname='linux lublin.zrz.tu-berlin.de 2.0.36 #2 mon jun 26 12:24:02 mest 2000 i586 unknown '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-I/usr/local/include'
    ccversion='', gccversion='2.7.2.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil
    libc=/lib/libc-2.0.7.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/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.6.1:
    /opt/home/anno4000/lib/perl
    /usr/local/lib/perl5/5.6.1/i586-linux
    /usr/local/lib/perl5/5.6.1
    /usr/local/lib/perl5/site_perl/5.6.1/i586-linux
    /usr/local/lib/perl5/site_perl/5.6.1
    /usr/local/lib/perl5/site_perl/5.6.0/i586-linux
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.6.1:
    HOME=/opt/home/anno4000
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/X11R6/lib:/usr/local/LessTif/Motif1.2/lib
    LOGDIR (unset)
    PATH=/opt/home/anno4000/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games
    PERL5LIB=/opt/home/anno4000/lib/perl
    PERL_BADLANG (unset)
    PERL_PRIVLIB=/usr/local/lib/perl5/5.6.1
    PERL_SITELIB=/usr/local/lib/perl5/site_perl/5.6.1
    SHELL=/bin/tcsh


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