develooper Front page | perl.perl5.porters | Postings from September 2010

[perl #77928] Glob slot assignment and set-magic

From:
Father Chrysostomos via RT
Date:
September 28, 2010 11:19
Subject:
[perl #77928] Glob slot assignment and set-magic
Message ID:
rt-3.6.HEAD-24759-1285697952-133.77928-15-0@perl.org
On Sun Sep 19 12:17:11 2010, sprout wrote:
> On Sun Sep 19 12:13:48 2010, sprout wrote:
> > package Readonly::Alias;
> > sub TIESCALAR { bless \(my $x = \pop) }
> > sub FETCH { $${$_[0]} }
> > sub STORE { die "Assignment to read-only value" }
> > package main;
> > tie $alias, "Readonly::Alias", $var;
> > $var = *foo;
> > print $alias; # prints *main::foo
> > # Now modify a glob slot, not the alias itself:
> > *$alias = []; # bang
> > 
> > I don’t think assignment *through* a glob should count as assignment
> > to the glob itself. So there’s no need to call set-magic in this case.
> 
> Here is a patch.

Applied as cffb36981555.




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