THRIFT-847 Test Framework harmonization across all languages
THRIFT-2946 Enhance usability of cross test framework

Patch: Nobuaki Sukegawa

This closes: #358
diff --git a/test/perl/Makefile.am b/test/perl/Makefile.am
index 291106b..d975f69 100644
--- a/test/perl/Makefile.am
+++ b/test/perl/Makefile.am
@@ -17,11 +17,13 @@
 # under the License.
 #
 
-THRIFT = $(top_srcdir)/compiler/cpp/thrift
+THRIFT = $(top_builddir)/compiler/cpp/thrift
 
 stubs: ../ThriftTest.thrift
 	$(THRIFT) --gen perl ../ThriftTest.thrift
 
+precross: stubs
+
 check: stubs
 
 clean-local:
diff --git a/test/perl/TestClient.pl b/test/perl/TestClient.pl
index ca1d47e..5a9a6f1 100644
--- a/test/perl/TestClient.pl
+++ b/test/perl/TestClient.pl
@@ -41,6 +41,11 @@
 my $host = 'localhost';
 my $port = 9090;
 
+foreach my $arg (@ARGV) {
+  if($arg =~ /^--port=([0-9]+)/) {
+    $port = $1;
+  }
+}
 
 my $socket = new Thrift::Socket($host, $port);