diff options
author | Dean Hamstead <dean@fragfest.com.au> | 2018-10-17 18:48:42 +1100 |
---|---|---|
committer | James E. King III <jking@apache.org> | 2018-10-17 19:13:45 -0400 |
commit | 8a130f63e5bd09e5c39f9760ba04b5ea0837ff4c (patch) | |
tree | fa2102f587cd526e308adf528eb447d06c3d0988 /tutorial/perl | |
parent | 7a51220c02d31c831e446906784836e9b3cd53b6 (diff) | |
download | thrift-8a130f63e5bd09e5c39f9760ba04b5ea0837ff4c.tar.gz |
THRIFT-4382: Replace the use of Indirect Object Syntax calls to new()
Diffstat (limited to 'tutorial/perl')
-rw-r--r-- | tutorial/perl/PerlClient.pl | 12 | ||||
-rw-r--r-- | tutorial/perl/PerlServer.pl | 16 |
2 files changed, 14 insertions, 14 deletions
diff --git a/tutorial/perl/PerlClient.pl b/tutorial/perl/PerlClient.pl index 1d596568d..7c23289ce 100644 --- a/tutorial/perl/PerlClient.pl +++ b/tutorial/perl/PerlClient.pl @@ -37,10 +37,10 @@ use tutorial::Types; use Data::Dumper; -my $socket = new Thrift::Socket('localhost',9090); -my $transport = new Thrift::BufferedTransport($socket,1024,1024); -my $protocol = new Thrift::BinaryProtocol($transport); -my $client = new tutorial::CalculatorClient($protocol); +my $socket = Thrift::Socket->new('localhost',9090); +my $transport = Thrift::BufferedTransport->new($socket,1024,1024); +my $protocol = Thrift::BinaryProtocol->new($transport); +my $client = tutorial::CalculatorClient->new($protocol); eval{ @@ -53,7 +53,7 @@ eval{ my $sum = $client->add(1,1); print "1+1=$sum\n"; - my $work = new tutorial::Work(); + my $work = tutorial::Work->new(); $work->op(tutorial::Operation::DIVIDE); $work->num1(1); @@ -63,7 +63,7 @@ eval{ $client->calculate(1, $work); print "Whoa! We can divide by zero?\n"; }; if($@) { - warn "InvalidOperation: ".Dumper($@); + warn 'InvalidOperation: '.Dumper($@); } $work->op(tutorial::Operation::SUBTRACT); diff --git a/tutorial/perl/PerlServer.pl b/tutorial/perl/PerlServer.pl index adec97863..dfe6b89a1 100644 --- a/tutorial/perl/PerlServer.pl +++ b/tutorial/perl/PerlServer.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # # Licensed to the Apache Software Foundation (ASF) under one @@ -67,20 +67,20 @@ sub calculate } elsif ($op == tutorial::Operation::DIVIDE) { if ($num2 == 0) { - my $x = new tutorial::InvalidOperation; + my $x = tutorial::InvalidOperation->new(); $x->whatOp($op); $x->why('Cannot divide by 0'); die $x; } $val = $num1 / $num2; } else { - my $x = new tutorial::InvalidOperation; + my $x = tutorial::InvalidOperation->new(); $x->whatOp($op); $x->why('Invalid operation'); die $x; } - my $log = new shared::SharedStruct; + my $log = shared::SharedStruct->new(); $log->key($logid); $log->value(int($val)); $self->{log}->{$logid} = $log; @@ -104,10 +104,10 @@ sub zip eval { - my $handler = new CalculatorHandler; - my $processor = new tutorial::CalculatorProcessor($handler); - my $serversocket = new Thrift::ServerSocket(9090); - my $forkingserver = new Thrift::ForkingServer($processor, $serversocket); + my $handler = CalculatorHandler->new(); + my $processor = tutorial::CalculatorProcessor->new($handler); + my $serversocket = Thrift::ServerSocket->new(9090); + my $forkingserver = Thrift::ForkingServer->new($processor, $serversocket); print "Starting the server...\n"; $forkingserver->serve(); print "done.\n"; |