Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Where is Data::Dumper->Dumpx?

by perlboy_emeritus (Sexton)
on Feb 08, 2018 at 21:38 UTC ( #1208751=perlquestion: print w/replies, xml ) Need Help??
perlboy_emeritus has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

In Sriram Srinivasan's outstanding 1997 book "Advanced Perl Programming" published by O'Reilly, he writes on page 158 about Data::Dumper:

"You can substitute Dumpx for Dump and take advantage of a C extension that implements the same functionality and gives you a speed increase of four to five times."

What ever happened to Dumpx? It does not appear to be in that module.

Replies are listed 'Best First'.
Re: Where is Data::Dumper->Dumpx?
by choroba (Bishop) on Feb 08, 2018 at 21:47 UTC
    See $Data::Dumper::Useperl in Data::Dumper's documentation.

    Can be set to a boolean value which controls whether the pure Perl implementation of Data::Dumper is used. The Data::Dumper module is a dual implementation, with almost all functionality written in both pure Perl and also in XS ('C'). Since the XS version is much faster, it will always be used if possible. This option lets you override the default behavior, usually for testing purposes only. Default is 0, which means the XS implementation will be used if possible.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
Re: Where is Data::Dumper->Dumpx?
by haukex (Canon) on Feb 10, 2018 at 12:35 UTC
    What ever happened to Dumpx? It does not appear to be in that module.

    A search of the git history of the Perl core seems to show that there never was a Dumpx function - only Dumpxs, so it might just be a typo in the book. Dumpxs is still there, but as choroba already pointed out, Data::Dumper defaults to the XS implementation (maybe it didn't in the past), so you normally don't have to worry about it.

    $ perl -MData::Dumper -e 'print Data::Dumper->new(["foo"])->Dumpxs' $VAR1 = 'foo';

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1208751]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2018-12-13 07:33 GMT
Find Nodes?
    Voting Booth?
    How many stories does it take before you've heard them all?

    Results (62 votes). Check out past polls.