Thrift now a TLP - INFRA-3116

git-svn-id: https://svn.apache.org/repos/asf/thrift/branches/0.1.x@1028168 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tutorial/erl/client.erl b/tutorial/erl/client.erl
new file mode 100644
index 0000000..9780334
--- /dev/null
+++ b/tutorial/erl/client.erl
@@ -0,0 +1,74 @@
+%%
+%% Licensed to the Apache Software Foundation (ASF) under one
+%% or more contributor license agreements. See the NOTICE file
+%% distributed with this work for additional information
+%% regarding copyright ownership. The ASF licenses this file
+%% to you under the Apache License, Version 2.0 (the
+%% "License"); you may not use this file except in compliance
+%% with the License. You may obtain a copy of the License at
+%%
+%%   http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing,
+%% software distributed under the License is distributed on an
+%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+%% KIND, either express or implied. See the License for the
+%% specific language governing permissions and limitations
+%% under the License.
+%%
+
+-module(client).
+
+-include("calculator_thrift.hrl").
+
+-export([t/0]).
+
+p(X) ->
+    io:format("~p~n", [X]),
+    ok.
+
+t() ->
+    Port = 9999,
+    
+    {ok, Client} = thrift_client:start_link("127.0.0.1",
+                                            Port,
+                                            calculator_thrift),
+
+    thrift_client:call(Client, ping, []),
+    io:format("ping~n", []),
+
+    {ok, Sum} = thrift_client:call(Client, add,  [1, 1]),
+    io:format("1+1=~p~n", [Sum]),
+
+    {ok, Sum1} = thrift_client:call(Client, add, [1, 4]),
+    io:format("1+4=~p~n", [Sum1]),
+
+    Work = #work{op=?tutorial_SUBTRACT,
+                 num1=15,
+                 num2=10},
+    {ok, Diff} = thrift_client:call(Client, calculate, [1, Work]),
+    io:format("15-10=~p~n", [Diff]),
+
+    {ok, Log} = thrift_client:call(Client, getStruct, [1]),
+    io:format("Log: ~p~n", [Log]),
+
+    try
+        Work1 = #work{op=?tutorial_DIVIDE,
+                      num1=1,
+                      num2=0},
+        {ok, _Quot} = thrift_client:call(Client, calculate, [2, Work1]),
+
+        io:format("LAME: exception handling is broken~n", [])
+    catch
+        Z ->
+            io:format("Got exception where expecting - the " ++
+                      "following is NOT a problem!!!~n"),
+            p(Z)
+    end,
+
+
+    {ok, ok} = thrift_client:call(Client, zip, []),
+    io:format("zip~n", []),
+
+    ok = thrift_client:close(Client),
+    ok.