The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tapir::MethodCall - A method call

DESCRIPTION

The MethodCall object represents all the context and data necessary for a single method call within the API. It's generated by a Tapir::Server (most likely the Tapir::Server::ThriftAMQP) when a new request is taken off the wire.

This is a generic module, to be used with any Tapir::Server, but for simplicity sake we will act as though you'll be using the ThriftAMQP server, because you likely will be.

The MethodCall is a subclass of POE::Component::Sequence, and will contain all the logic necessary to handle a request in it's action and callback sequences.

Class Methods

new ($key, $value, ...)

Call with a list of key/value pairs to setup a new method sequence. See "Accessors" for which keys are standard.

Object Methods

Accessors

service (type Thrift::IDL::Service)

The IDL definition of the service.

method (type Thrift::IDL::Method)

The IDL definition of the method.

arguments (type Thrift::Parser::FieldSet)

The parsed message arguments.

message (type Thrift::Parser::Message)

The parsed message.

transport

Meta data from the transport layer; includes header information and raw frames. See "subscribe" in POE::Component::Client::AMQP::Queue. Hash like:

header_frame (type Net::AMQP::Protocol::Basic::ContentHeader)
method_frame (type Net::AMQP::Protocol::Basic::Publish)
body_frames (array of type Net::AMQP::Frame::Body)
logger

The logger inherited from Tapir::Server

authentication

The return value of "is_valid_request" in Tapir::Server.

server

The Tapir::Server object.

args

Calls dereference_fieldset on the message arguments with plain => 1 and insecure => 0. Returns a hash.

args_thrift

Calls dereference_fieldset on the message arguments with plain => 0 and insecure => 0. Returns a hash.

dereference_fieldset

  my $hash = dereference_fieldset($parser_fieldset, { plain => 0, insecure => 0 });

Internal, recursive algorithm that will descend into the fieldset given and return a perl hash representing the structure. The keys of the hash will be the 'name' method of the Thrift::Parser::Field. The value of the hash will be either the 'value' or 'value_plain' method of the Thrift::Parser::Field, depending on the passed value of 'plain'. If the value is another fieldset, this subroutine will call itself on that value for the stored value.

If 'insecure' is true, any fields which have a '@secure' flag in the documentation will have their values replaced with a placeholder string.

Returns an arrayref of AMQP headers. You probably want header() (below).

  my $status_queue = $self->header('Request-Status-Queue');

Returns the value of a header. Case insensitive.

Finishing methods

These methods all store the scalar value passed as the method reply value and finish the sequence. It's expected that the calling code will return after calling one of these finishing methods:

  return $method_call->set_result(145);

The result can be either a fully typed Thrift::Parser::Type object or a untyped Perl scalar which will be cast into the expected value.

set_result

See Thrift::Parser::Message::compose_reply.

set_error

See Thrift::Parser::Message::compose_reply_application_exception; throws an 'UNKNOWN' application error with the text of this error message.

set_exception

Takes an IDL-defined exception (as a hash ref or blessed reference, see Thrift::Parser::Message::compose_reply_exception) or TApplicationException.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 170:

Unknown directive: =heac2