develooper Front page | perl.perl5.porters | Postings from November 2013

[perl #82948] Data::Dumper error repeatly serializes

From:
Tony Cook via RT
Date:
November 21, 2013 05:56
Subject:
[perl #82948] Data::Dumper error repeatly serializes
Message ID:
rt-4.0.18-4744-1385013389-592.82948-15-0@perl.org
On Mon Jan 31 03:33:15 2011, demerphq wrote:
> Data::Dump::Streamer does this properly, and there is no longer any
> reason that DD does not. The routine that DDS uses for this has been
> in core in the re namespace for some time:
> 
> my ($pat,$mods)=regexp_pattern(qr/foo/i);
> 
> So DD could use it to extract the flags and pattern without them being
> wrapped in (?...) brackets, and thus round trip regexen properly.

Data::Dumper has code to do this, but it's only used when the regexp is blessed into
another package.

And the XS Dumper doesn't do it at all.

I've attached a patch that modifies Data::Dumper to dump regexp objects using the list form of regexp_pattern(), both in the perl and XS code paths.

Is this the desired behaviour?

One thing neither the old nor the new code handles specially is regexps containing control characters or unicode - they're simply included as is in the dumped string, I bring this up since the discussion in 113088 implied that it was useful for Data::Dumper to produce pure ASCII.

Tony

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



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