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

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

Tony Cook via RT
November 21, 2013 05:56
[perl #82948] Data::Dumper error repeatly serializes
Message ID:
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.


via perlbug:  queue: perl5 status: open Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About