Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot alias tied filehandle #811

Closed
p5pRT opened this issue Nov 3, 1999 · 7 comments
Closed

cannot alias tied filehandle #811

p5pRT opened this issue Nov 3, 1999 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 3, 1999

Migrated from rt.perl.org#1739 (status was 'resolved')

Searchable as RT1739$

@p5pRT
Copy link
Author

p5pRT commented Nov 3, 1999

From sey@tera.kyoto.jkc.co.jp

I cannot alias a tied filehandle with type glob assignment.

  tie *H, 'Test';
  *K = *H;
  print "*H is tied '",tied(*H),"'\n";
  print "*K is tied '",tied(*K),"'\n";
  sub Test​::TIEHANDLE { bless {}, shift; }

This prints as follows.

  *H is tied 'Test=HASH(0xba0c40)'
  *K is tied ''

I have an alternate way as follows. But it is not usable for practical
use.

  tie *H, 'Test';
  tie *K, 'AliasTieHandle', tied(*H);
  print "*H is tied '",tied(*H),"'\n";
  print "*K is tied '",tied(*K),"'\n";
  sub Test​::TIEHANDLE { bless {}, shift; }
  sub AliasTieHandle​::TIEHANDLE { shift; shift; }

Perl Info


Site configuration information for perl 5.00503:

Configured by sey at Mon Nov  1 16:38:39 JST 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=freebsd, osvers=2.2.8-release, archname=i386-freebsd
    uname='freebsd tera.kyoto.jkc.co.jp 2.2.8-release freebsd 2.2.8-release #0: mon nov 30 06:34:08 gmt 1998 jkh@time.cdrom.com:usrsrcsyscompilegeneric i386 '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-g', gccversion=2.7.2.1
    cppflags='-DDEBUGGING -I/usr/local/include'
    ccflags ='-DDEBUGGING -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=true
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-lgdbm -lm -lc -lcrypt
    libc=/usr/lib/libc.so.3.1, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fpic', lddlflags='-Bshareable  -L/usr/local/lib'

Locally applied patches:
    jperl5.005_03-990822.pat - end of week


@INC for perl 5.00503:
    /usr/local/lib/perl5/5.00503/i386-freebsd
    /usr/local/lib/perl5/5.00503
    /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
    /usr/local/lib/perl5/site_perl/5.005
    .


Environment for perl 5.00503:
    HOME=/home/sey
    LANG=ja_JP.EUC
    LANGUAGE (unset)
    LC_ALL=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:/home/sey/bin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/tcsh

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2000

From [Unknown Contact. See original ticket]

This appears to still be true under bleadperl 8101.

This is a bug report for perl from sey@​tera.kyoto.jkc.co.jp,
generated with the help of perlbug 1.26 running under perl 5.00503.

-----------------------------------------------------------------
[Please enter your report here]
I cannot alias a tied filehandle with type glob assignment.

  tie *H, 'Test';
  *K = *H;
  print "*H is tied '",tied(*H),"'\n";
  print "*K is tied '",tied(*K),"'\n";
  sub Test​::TIEHANDLE { bless {}, shift; }

This prints as follows.

  *H is tied 'Test=HASH(0xba0c40)'
  *K is tied ''

I have an alternate way as follows. But it is not usable for practical
use.

  tie *H, 'Test';
  tie *K, 'AliasTieHandle', tied(*H);
  print "*H is tied '",tied(*H),"'\n";
  print "*K is tied '",tied(*K),"'\n";
  sub Test​::TIEHANDLE { bless {}, shift; }
  sub AliasTieHandle​::TIEHANDLE { shift; shift; }

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2000

From @mjdominus

I cannot alias a tied filehandle with type glob assignment.

tie *H, 'Test';
*K = *H;

I thought that the reson this didn't work is that the glob was copied,
similar to the way

  tie $H, 'Text';
  $K = $H;

does not leave $K tied.

Some time ago I reported what seems to be a related problem​:

  bless \*H => 'Test';
  *K = *H;

and *K is not blessed. I was told that this was not a bug.

I will hunt up the mail if anyone thinks it would be illuminating.

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2000

From [Unknown Contact. See original ticket]

I'll close it.

-spp

Lightning flashed, thunder crashed and Mark-Jason Dominus <mjd@​plover.com> whis
pered​:
|
| > I cannot alias a tied filehandle with type glob assignment.
| >
| > tie *H, 'Test';
| > *K = *H;
|
| I thought that the reson this didn't work is that the glob was copied,
| similar to the way
|
| tie $H, 'Text';
| $K = $H;
|
| does not leave $K tied.
|
| Some time ago I reported what seems to be a related problem​:
|
| bless \*H => 'Test';
| *K = *H;
|
| and *K is not blessed. I was told that this was not a bug.
|
| I will hunt up the mail if anyone thinks it would be illuminating.

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2000

From @mjdominus

I'll close it.

I wasn't suggesting that you close it. I was hoping that someone with
more expertise would weigh in.

@p5pRT
Copy link
Author

p5pRT commented Dec 13, 2000

From @floatingatoll

So, how do I go about making a copy of $H or *H that retains all the special
stuff like ties and blessedness? As this is not a bug, I can't see any way
to do it.

R.

I thought that the reson this didn't work is that the glob was copied,
similar to the way

    tie $H\, 'Text';
    $K = $H;

does not leave $K tied.

Some time ago I reported what seems to be a related problem​:

    bless \\\*H => 'Test';
    \*K = \*H;

and *K is not blessed. I was told that this was not a bug.

R.

@p5pRT
Copy link
Author

p5pRT commented Aug 7, 2002

@gbarr - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant