develooper Front page | perl.perl5.porters | Postings from January 2015

[perl #123218] Setting $/ to a FOO reference is only half forbidden

From:
Tony Cook via RT
Date:
January 28, 2015 05:47
Subject:
[perl #123218] Setting $/ to a FOO reference is only half forbidden
Message ID:
rt-4.0.18-25458-1422424021-903.123218-15-0@perl.org
On Sun Nov 16 04:47:05 2014, leonerd@leonerd.org.uk wrote:
> On Sat, 15 Nov 2014 16:37:31 -0800
> Father Chrysostomos (via RT) <perlbug-followup@perl.org> wrote:
> 
> > It croaks, but the assignment happens anyway, because the croak is
> > too late.  Either this should be a warning, or we should arrange for
> > the previous value of $/ to be preserved.
> 
> Isn't this just what 'set' magic does though? It can't prevent the
> assignment happening, because it's invoked afterwards. It just observes
> the effect once it has.
> 
> Having the 'set' magic store the previous value and restore it on bad
> assignments before croaking could be easy enough though; seems nicer
> than downgrading it to a warning that still leads to broken behaviour.

The valued used by the interpreter is stored in PL_rs, we can just return that in Perl_get_magic().

Tony


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=123218



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