From: T Jake Luciani Date: Fri, 17 Jul 2009 01:34:50 +0000 (+0000) Subject: THRIFT-542: Perl compiler uses invalid method 'method_exists' and subsequent test X-Git-Tag: 0.2.0~75 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=f1fd2954b5e3646fe98f0faa06a0ab9f2c61e98c;p=common%2Fthrift.git 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 ae204fd9..17934ce6 100644 --- a/compiler/cpp/src/generate/t_perl_generator.cc +++ b/compiler/cpp/src/generate/t_perl_generator.cc @@ -781,7 +781,7 @@ void t_perl_generator::generate_service_processor(t_service* tservice) { // 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 @@ void t_perl_generator::generate_process_function(t_service* tservice, f_service_ << indent() << "my $self = shift;"<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 0e5d61d3..64d7958b 100644 --- a/lib/perl/lib/Thrift/BinaryProtocol.pm +++ b/lib/perl/lib/Thrift/BinaryProtocol.pm @@ -477,7 +477,7 @@ sub readStringBody # # Binary Protocol Factory # -package TBinaryProtocolFactory; +package Thrift::BinaryProtocolFactory; use base('TProtocolFactory'); sub new @@ -492,7 +492,7 @@ sub getProtocol{ 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 ce87c48d..795aaed3 100644 --- a/lib/perl/test/Makefile.am +++ b/lib/perl/test/Makefile.am @@ -28,4 +28,4 @@ gen-perl/ThriftTest/Types.pm: $(THRIFT_IF) clean-local: rm -rf gen-perl -EXTRA_DIST = memory_buffer.t +EXTRA_DIST = memory_buffer.t processor.t