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

[ID 19991103.009] cannot alias tied filehandle

Thread Next
From:
Stephen P. Potter
Date:
December 13, 2000 10:48
Subject:
[ID 19991103.009] cannot alias tied filehandle
Message ID:
200012131850.NAA05787@spotter.yi.org
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; }



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