On Wed, Jul 20, 2005 at 01:27:51AM +0100, Dave Mitchell wrote:
> On Mon, Mar 21, 2005 at 08:42:11PM -0000, philippe. cote @ usherbrooke. ca 
> wrote:
> > sv_rvweaken doesn't handle tied variables
> > 
> > Proof :
> > 
> > +-------------------------------------------------------------------------+
> > Sample code
> > +-------------------------------------------------------------------------+
> > #!/usr/bin/perl
> > use strict;
> > use warnings;
> > use Util::Monitor;
> > 
> > use Scalar::Util qw(weaken);
> > use Devel::Peek;
> > {
> >      my (@a);
> >      $a[0] = [EMAIL PROTECTED];
> >      #tie @a, 'TestArray';
> >      Dump($a[0],1);
> >      weaken($a[0]);
> >      Dump($a[0],1);
> >      print "Leaving scope\n";
> > }
> > print "Scope left\n";
> > 
> > package TestArray;
> > use Tie::Array;
> > use base 'Tie::StdArray';
> > 
> > sub DESTROY { print "Monitor::TestArray::DESTROY : $_[0]\n"; }
> 
> 
> I'm not really sure what you expect the effect of weakening a tied array
> element should be. I suspect that in the general case doing this makes no
> sense.

To put it another way, the tied element $a[0] acts like a black box around
whatever the tying object does; you can put things in the box or take them
out, but you can't modify the contents of the box the way weaken does.

Unless someone implements support for a WEAKEN method...

Reply via email to