summaryrefslogtreecommitdiff
path: root/test/perl
diff options
context:
space:
mode:
authorMark Slee <mcslee@apache.org>2007-09-19 06:49:30 +0000
committerMark Slee <mcslee@apache.org>2007-09-19 06:49:30 +0000
commit8266443d925794b4323bae7cc840f5a9827ac874 (patch)
tree146ffeadd96ac21ba0fa58b1b5bc7ef68f9cb25d /test/perl
parentb8f0d496c16504f43e0d5c9ec6e6090742a4a086 (diff)
downloadthrift-8266443d925794b4323bae7cc840f5a9827ac874.tar.gz
OO perl accessors for Thrift objects
Summary: Submitted by Jake Luciani Reviewed By: cpiro Test Plan: Supplied in test/tutorial code git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665276 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/perl')
-rw-r--r--test/perl/TestClient.pl54
1 files changed, 27 insertions, 27 deletions
diff --git a/test/perl/TestClient.pl b/test/perl/TestClient.pl
index 4e6278e58..82e832058 100644
--- a/test/perl/TestClient.pl
+++ b/test/perl/TestClient.pl
@@ -83,33 +83,33 @@ print(" = $dub\n");
# STRUCT TEST
#
print("testStruct({\"Zero\", 1, -3, -5})");
-my $out = new Xtruct();
-$out->{string_thing} = "Zero";
-$out->{byte_thing} = 1;
-$out->{i32_thing} = -3;
-$out->{i64_thing} = -5;
+my $out = new ThriftTest::Xtruct();
+$out->string_thing("Zero");
+$out->byte_thing(1);
+$out->i32_thing(-3);
+$out->i64_thing(-5);
my $in = $testClient->testStruct($out);
-print(" = {\"".$in->{string_thing}."\", ".
- $in->{byte_thing}.", ".
- $in->{i32_thing}.", ".
- $in->{i64_thing}."}\n");
+print(" = {\"".$in->string_thing."\", ".
+ $in->byte_thing.", ".
+ $in->i32_thing.", ".
+ $in->i64_thing."}\n");
#
# NESTED STRUCT TEST
#
print("testNest({1, {\"Zero\", 1, -3, -5}, 5}");
-my $out2 = new Xtruct2();
-$out2->{byte_thing} = 1;
-$out2->{struct_thing} = $out;
-$out2->{i32_thing} = 5;
+my $out2 = new ThriftTest::Xtruct2();
+$out2->byte_thing(1);
+$out2->struct_thing($out);
+$out2->i32_thing(5);
my $in2 = $testClient->testNest($out2);
-$in = $in2->{struct_thing};
-print(" = {".$in2->{byte_thing}.", {\"".
- $in->{string_thing}."\", ".
- $in->{byte_thing}.", ".
- $in->{i32_thing}.", ".
- $in->{i64_thing}."}, ".
- $in2->{i32_thing}."}\n");
+$in = $in2->struct_thing;
+print(" = {".$in2->byte_thing.", {\"".
+ $in->string_thing."\", ".
+ $in->byte_thing.", ".
+ $in->i32_thing.", ".
+ $in->i64_thing."}, ".
+ $in2->i32_thing."}\n");
#
# MAP TEST
@@ -221,13 +221,13 @@ print("}\n");
#
# INSANITY TEST
#
-my $insane = new Insanity();
+my $insane = new ThriftTest::Insanity();
$insane->{userMap}->{Numberz::FIVE} = 5000;
-my $truck = new Xtruct();
-$truck->{string_thing} = "Truck";
-$truck->{byte_thing} = 8;
-$truck->{i32_thing} = 8;
-$truck->{i64_thing} = 8;
+my $truck = new ThriftTest::Xtruct();
+$truck->string_thing("Truck");
+$truck->byte_thing(8);
+$truck->i32_thing(8);
+$truck->i64_thing(8);
push(@{$insane->{xtructs}}, $truck);
print("testInsanity()");
@@ -269,7 +269,7 @@ print("testException('Xception')");
eval {
$testClient->testException('Xception');
print(" void\nFAILURE\n");
-}; if($@ && $@->UNIVERSAL::isa('Xception')) {
+}; if($@ && $@->UNIVERSAL::isa('ThriftTest::Xception')) {
print(' caught xception '.$@->{errorCode}.': '.$@->{message}."\n");
}