THRIFT-542: Perl compiler uses invalid method 'method_exists' and subsequent test
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@794938 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_perl_generator.cc b/compiler/cpp/src/generate/t_perl_generator.cc
index ae204fd..17934ce 100644
--- a/compiler/cpp/src/generate/t_perl_generator.cc
+++ b/compiler/cpp/src/generate/t_perl_generator.cc
@@ -781,7 +781,7 @@
// HOT: check for method implementation
f_service_ <<
indent() << "my $methodname = 'process_'.$fname;" << endl <<
- indent() << "if (!method_exists($self, $methodname)) {" << endl;
+ indent() << "if (!$self->can($methodname)) {" << endl;
f_service_ <<
indent() << " $input->skip(TType::STRUCT);" << endl <<
@@ -824,7 +824,7 @@
f_service_ <<
indent() << "my $self = shift;"<<endl<<
- indent() << "my ($seqid, $input, $output); " << endl;
+ indent() << "my ($seqid, $input, $output) = @_;" << endl;
string argsname = perl_namespace(tservice->get_program()) + service_name_ + "_" + tfunction->get_name() + "_args";
string resultname = perl_namespace(tservice->get_program()) + service_name_ + "_" + tfunction->get_name() + "_result";
diff --git a/lib/perl/lib/Thrift/BinaryProtocol.pm b/lib/perl/lib/Thrift/BinaryProtocol.pm
index 0e5d61d..64d7958 100644
--- a/lib/perl/lib/Thrift/BinaryProtocol.pm
+++ b/lib/perl/lib/Thrift/BinaryProtocol.pm
@@ -477,7 +477,7 @@
#
# Binary Protocol Factory
#
-package TBinaryProtocolFactory;
+package Thrift::BinaryProtocolFactory;
use base('TProtocolFactory');
sub new
@@ -492,7 +492,7 @@
my $self = shift;
my $trans = shift;
- return new TBinaryProtocol($trans);
+ return new Thrift::BinaryProtocol($trans);
}
1;
diff --git a/lib/perl/test/Makefile.am b/lib/perl/test/Makefile.am
index ce87c48..795aaed 100644
--- a/lib/perl/test/Makefile.am
+++ b/lib/perl/test/Makefile.am
@@ -28,4 +28,4 @@
clean-local:
rm -rf gen-perl
-EXTRA_DIST = memory_buffer.t
+EXTRA_DIST = memory_buffer.t processor.t