This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #101162] DD support for vstrings
authorFather Chrysostomos <sprout@cpan.org>
Sun, 25 Dec 2011 21:45:31 +0000 (13:45 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 25 Dec 2011 22:36:16 +0000 (14:36 -0800)
commitd036e907fea37ee5e02513cbfec02863e69d43a9
tree3bd7e072f830d97a4a140e38d95c08ac0a0026ea
parent5e4660d61c6eafa613b82d3a7640d615813996e0
[perl #101162] DD support for vstrings

This commit adds support for vstrings to Data::Dumper, in both Perl
and XS implementations.

Since the actual vstring cannot be obtained from pure Perl, there is a
new _vstring XS function that the PP implementation uses, falling back
to sprintf "%vd" if XS is not available.  The former dumps v1.2_3 cor-
rectly, while the latter produces v1.23.  (I could make it use B to
extract the correct string, but XS is likely to be unavailable in
those circumstances where B is also unavailable [i.e., miniperl], so
it didn’t seem worth the effort.)

Some Perl versions (read: *all* released versions as of this message)
let vstring magic linger too long on strings that have been modified.
So that is checked for, but the bug is probed at compile time and the
code is #ifdeffed or use-constanted out when the bug is not present.

Due to the definition of the _bad_vsmg constant, I had to move
XSLoader::load into the BEGIN block.  Since I was putting it there,
I combined it, the $Useperl = 1 and the eval{} into one statement,
for speed.

Since I was putting XSLoader::load into a BEGIN block, $VERSION needed
to be in one, too.
dist/Data-Dumper/Dumper.pm
dist/Data-Dumper/Dumper.xs
dist/Data-Dumper/t/dumper.t