6 use lib
'../../lib/perl/lib';
10 use Thrift
::BinaryProtocol
;
12 use Thrift
::BufferedTransport
;
21 my $socket = new Thrift
::Socket
('localhost',9090);
22 my $transport = new Thrift
::BufferedTransport
($socket,1024,1024);
23 my $protocol = new Thrift
::BinaryProtocol
($transport);
24 my $client = new CalculatorClient
($protocol);
34 my $sum = $client->add(1,1);
37 my $work = new tutorial
::Work
();
39 $work->op(Operation
::DIVIDE
);
44 $client->calculate(1, $work);
45 print "Whoa! We can divide by zero?\n";
47 warn "InvalidOperation: ".Dumper
($@
);
50 $work->op(Operation
::SUBTRACT
);
53 my $diff = $client->calculate(1, $work);
54 print "15-10=$diff\n";
56 my $log = $client->getStruct(1);
57 print "Log: $log->{value}\n";