gisle / data-dump Goto Github PK
View Code? Open in Web Editor NEWA Perl module for pretty printing of data structures
Home Page: http://search.cpan.org/dist/Data-Dump/
A Perl module for pretty printing of data structures
Home Page: http://search.cpan.org/dist/Data-Dump/
Hi
I am using Data::Dump v1.23 and found issue that Data::Dump::dump sliently changes string to integer to cause YAML dump print incorrect result.
Here are the example code
use YAML::XS;
use Data::Dump;
my $data = { id => [ '0123', '0234']};
print "before dump\n";
print YAML::XS::Dump($data);
Data::Dump::dump($data);
print "after dump\n";
print YAML::XS::Dump($data);
And if i launch the script, you can find the second YAML::XS::Dump
print element in $data as integer.
$ perl testy.pl
before dump
---
id:
- '0123'
- '0234'
{ id => ["0123", "0234"] }
after dump
---
id:
- 0123
- 0234
I really like the more compact display that Data::Dump outputs, compared to Data::Dumper, when debugging.
Sometimes I dump objects that have a lot of stuff in them (say, DBIx::Class, Catalyst-objects) and without a maximum depth setting, the output is humongous - but with one, I can ignore all the "deep" stuff, that I usually don't need.
Any chance of implementing such a setting/parameter/configuration?
The Perl interpreter does not place any restrictions on class names.
However, class names with an '=' sign cause Data::Dump to issue a warning such as:
Can't handle >Table2|t2=HASH data at c:/opt/strawberry/perl/vendor/lib/Data/Dump.pm line 377.
Data::Dump then cannot dump the instance data.
There is a rough test case at https://gist.github.com/rjattrill/5955171 which can be used to demonstrate this.
See also https://rt.perl.org/rt3//Public/Bug/Display.html?id=101814 for a similar bug.
The CPAN module DBIx::DataModel creates classes dynamically and uses '<=>'
to indicate result sets based on dynamic table joins.
I have following "test-script.pl":
use Data::Dump "pp";
use JSON "to_json";
my $a = ["12"];
print "ORIG 1: ", to_json($a), "\n";
print "PP: ", pp($a), "\n";
print "ORIG 2: ", to_json($a), "\n";`
When I run it on perl 5.28.1, the original value in parameter is changed:
bash$ /opt/perl-5.28.1/bin/perl test-script.pl
ORIG 1: ["12"]
PP: [12]
ORIG 2: [12]
When I try same code in perl 5.26.3, the original value is not modified:
bash$ /opt/perl-5.26.3/bin/perl test-script.pl
ORIG 1: ["12"]
PP: [12]
ORIG 2: ["12"]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.