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

[perl #115430] Data::Dumper of regexps not idempotent

From:
Tony Cook via RT
Date:
January 28, 2014 04:30
Subject:
[perl #115430] Data::Dumper of regexps not idempotent
Message ID:
rt-4.0.18-14388-1390883404-1068.115430-15-0@perl.org
On Sat Dec 14 06:16:28 2013, tonyc wrote:
> On Fri, Dec 13, 2013 at 04:45:46PM -0800, James E Keenan via RT wrote:
> > On Mon Nov 12 19:59:39 2012, khw wrote:
> > > On Wed Oct 24 12:37:42 2012, smueller@cpan.org wrote:
> > > > On 10/24/2012 09:33 AM, demerphq wrote:
> > > > > On 23 October 2012 15:45, Brad Gilbert <b2gills@gmail.com>
> > > > > wrote:
> > > > >> The problem is internal to perl, so any module that prints it
> > > > >> out will
> > > > >> exhibit the same behaviour.
> > > > >
> > > > > Actually no it is not a core bug, it is a deficiency in the
> > > > > logic used
> > > > > by DD and other modules.  Data::Dump::Streamer has been doing
> > > > > this
> > > > > right for years, and the code to support doing it right was
> > > > > migrated
> > > > > from DDS to core long ago. See re::regexp_pattern() in list
> > > > > context.
> > > >
> > > > It is a bug in DD, not the core. But rt.perl.org is still the
> > > > appropriate place to file bugs. Data::Dumper is maintained as
> > > > part of
> > > > the core.
> > > >
> > > > --Steffen
> > > >
> > >
> > > I looked at Data::Dumper.pm source, and see this outdated comment:
> > >         # This really sucks, re:regexp_pattern is in ext/re/re.xs
> > > and
> > >  not in
> > >         # universal.c, and even worse we cant just require that re
> > > to be
> > > loaded
> > >          # we *have* to use() it.
> > >         # We should probably move it to universal.c for 5.10.1 and
> > > fix this.
> > >         # Currently we only use re::regexp_pattern when the re is
> > > blessed into another
> > >         # package. This has the disadvantage of meaning that a DD
> > > dump
> > > won't round trip
> > >         # as the pattern will be repeatedly wrapped with the same
> > > modifiers.
> > >         # This is an aesthetic issue so we will leave it for now,
> > > but we
> > > could use
> > >         # regexp_pattern() in list context to get the modifiers
> > > separately.
> > >         # But since this means loading the full debugging engine in
> > > process we wont
> > >         # bother unless its necessary for accuracy.
> > >
> > > The reason it is outdated is that re::regexp_pattern has been put
> > > in
> > > universal.c
> > >
> >
> > Steffen, Karl, Yves:  Can we get an update on the status of this
> > ticket?
> 
> This looks like a duplicate of #82948, which I'll patch (though
> perhaps not a final patch) this week.

The fix for 82948 fixes this, so closing.

Tony

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



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