#!/usr/bin/perl -w
use Google::ProtocolBuffers;
use File::Slurp qw(read_file write_file);
Google::ProtocolBuffers->parse("
message TestMessage {
required double tag1 = 1;
}
",
{create_accessors => 1 }
);
my $enc = TestMessage->encode({
tag1 => 0,
});
open my($fh), ">data.bin";
binmode $fh;
print $fh $enc;
close $fh;
my $dec = read_file('data.bin', { binmode => ':raw' });
my $protoc = TestMessage->decode($dec);
print $protoc->tag1;
And I get 0! Any number is rounded.
But, when I try to use the protoc command, everything is as it should.
C:\Users\user\Desktop>protoc --decode_raw < data.bin 1: 0x0000000000000000
And I get 0! Any number is rounded.
But, when I try to use the protoc command, everything is as it should.
C:\Users\user\Desktop>protoc --decode_raw < data.bin 1: 0x0000000000000000