[
https://issues.apache.org/jira/browse/THRIFT-3595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15308632#comment-15308632
]
David Morel commented on THRIFT-3595:
-------------------------------------
perl fun:
{noformat}
DB<27> use Storable qw(freeze thaw)
DB<28> @foo=(1, "1", 2);
DB<29> %stored = map { freeze(\$_) => 1 } @foo
DB<30> print 0+keys %stored
3
DB<31> $stored{freeze \"1"} = 1
DB<32> print 0+keys %stored
3
DB<33> $stored{freeze \"2"} = 1
DB<34> print 0+keys %stored
4
DB<48> $stored{freeze (bless {}, "Foo")} = 1
DB<50> print Dumper [map {thaw $_} (keys %stored)]
$VAR1 = [
\'2',
\1,
bless( {}, 'Foo' ),
\2,
\'1'
];
DB<63> print Dumper [map {$t = thaw $_; ref($t) =~ /(array|hash|scalar)/i ?
$$t : $t} (keys %stored)]
$VAR1 = [
'2',
1,
bless( {}, 'Foo' ),
2,
'1'
];
{noformat}
> Perl Bindings: Set serialization/deserialization differs
> --------------------------------------------------------
>
> Key: THRIFT-3595
> URL: https://issues.apache.org/jira/browse/THRIFT-3595
> Project: Thrift
> Issue Type: Bug
> Components: Perl - Compiler
> Affects Versions: 0.9.1, 0.9.2, 0.9.3
> Reporter: Adam Millerchip
>
> In the Perl bindings, a Thrift Set is dezerialized as a hashref, but the
> serialization code expects an arrayref. This causes the code to die when
> called if attempting to serialize a previously dezerialized Set.
> Additionally, it looks like there is a typo in the test that is testing this
> feature:
> https://github.com/apache/thrift/blob/49f4dc0cd8c87213a0f80ae1daba2d094a358ea7/test/perl/TestClient.pl#L262
> If you change that {{@$setout}} to {{@$setin}}, the test fails.
> It doesn't make much sense to implement a Set in Perl as array, because
> arrays allow duplicate entries and are ordered.
> I've written a change for the serialization that correctly expects a hashref:
> https://github.com/apache/thrift/pull/831
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)