mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-19 04:52:59 +01:00
Perl: display original data
This commit is contained in:
parent
0fe79a7752
commit
3275eee281
@ -6,20 +6,24 @@ use Storable;
|
||||
use Text::SimpleTable;
|
||||
|
||||
my @entries = (
|
||||
1,
|
||||
3.14,
|
||||
{},
|
||||
[],
|
||||
[('a')x10],
|
||||
{('a')x10},
|
||||
+{1,+{1,+{}}},
|
||||
+[+[+[]]],
|
||||
'1',
|
||||
'3.14',
|
||||
'{}',
|
||||
'[]',
|
||||
"[('a')x10]",
|
||||
"{('a')x10}",
|
||||
"+{1,+{1,+{}}}",
|
||||
"+[+[+[]]]",
|
||||
);
|
||||
|
||||
my $table = Text::SimpleTable->new([10, 'storable'], [10, 'msgpack']);
|
||||
my $table = Text::SimpleTable->new([15, 'src'], [9, 'storable'], [7, 'msgpack']);
|
||||
|
||||
for my $src (@entries) {
|
||||
my $e = eval $src;
|
||||
die $@ if $@;
|
||||
|
||||
for my $e (@entries) {
|
||||
$table->row(
|
||||
$src,
|
||||
length(Storable::nfreeze(ref $e ? $e : \$e)),
|
||||
length(Data::MessagePack->pack($e)),
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user