AMF-Connection

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension AMF::Connection.

0.10	Wed Sep 22 15:56:04 BST 2010
	- original version

0.20
	- updated AMF::Connection::OutputStream to report errors from Storable::AMF if any
	- added Storable::AMF parse and serialization options with parse_option()

0.21
	- Fixed check on Storable version for parse_option()

0.30	Wed May 11 18:07:11 BST 2011
	- Added callBatch () to make AMF batch RPC possible

0.31	Fri May 4 17:33:56 2012 +0100
	- Support different source and destination in AMF remoting package (patch by Aleksey Komarov)

lib/AMF/Connection.pm  view on Meta::CPAN


	# set any extra HTTP header
	map { $class->{'ua'}->default_header( $_ => $class->{'http_headers'}->{$_} ); } keys %{ $class->{'http_headers'} };

	my $http_response = $class->{'ua'}->post(
		$class->{'endpoint'}.$class->{'append_to_endpoint'}, # TODO - check if append to URL this really work for HTTP POST
		Content_Type => "application/x-amf",
		Content => $request_stream->getStreamData()
		);

	croak "HTTP POST error: ".$http_response->status_line."\n"
		unless($http_response->is_success);

	my $response_stream = new AMF::Connection::InputStream( $http_response->decoded_content, $class->{'input_amf_options'});
	my $response = new AMF::Connection::Message;
	$response->deserialize( $response_stream );

	#print STDERR Dumper( $response )."\n";

	# process AMF response headers
	$class->_process_response_headers( $response );

lib/AMF/Connection/InputStream.pm  view on Meta::CPAN

	      }
	    $self->{'options'} = Storable::AMF::parse_option ($storable_amf_options);
	  }

	return bless($self, $class);
	};

sub readBuffer {
	my ($class, $length) = @_;

	croak "Buffer underrun at position: ". $class->{'cursor'} . ". Trying to fetch ". $length . " bytes from buffer total length ".length($class->{'stream'})
		if($length + $class->{'cursor'} > length($class->{'stream'}));

        my $data = substr($class->{'stream'},$class->{'cursor'},$length);
	$class->{'cursor'}+=$length;
	
	return $data;
	};

sub readByte {
	my ($class) = @_;

lib/AMF/Connection/MessageBody.pm  view on Meta::CPAN

	};

sub getData {
	my ($class) = @_;

	return $class->{'data'};
	};

# HTTP::Response-ish methods ...

sub is_error {
	my ($class) = @_;

	return ($class->{'target'} =~ m|onStatus|) ? 1 : 0 ;
	};

sub is_success {
	my ($class) = @_;

	return ($class->{'target'} =~ m|onResult|) ? 1 : 0 ;
	};



( run in 1.596 second using v1.01-cache-2.11-cpan-49f99fa48dc )