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

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

From:
Tony Cook via RT
Date:
February 4, 2015 05:42
Subject:
[perl #123218] Setting $/ to a FOO reference is only half forbidden
Message ID:
rt-4.0.18-31747-1423028540-1726.123218-15-0@perl.org
On Tue Jan 27 21:47:01 2015, tonyc wrote:
> 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().

No objections (or responses of any sort.)

Applied as 5fe499a8e26270679c0c6d48431f3a328a8ffeba.

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