AMF-Connection

 view release on metacpan or  search on metacpan

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

AMF0 and AMF3 support is provided using the Storable::AMF module. While HTTP/S requestes to the AMF endpoint are carried out using the LWP::UserAgent module. The requests are sent using the HTTP POST method as AMF0 encoded data by default. AMF3 encod...

If encoding is set to AMF3 the Flex Messaging framework is used on returned responses content (I.e. objects casted to "flex.messaging.messages.AcknowledgeMessage" and "flex.messaging.messages.ErrorMessage" are returned).

Simple batch requests and responses is provided also.

See the sample usage synopsis above to start using the module.

=head1 DATE TYPE SUPPORT

The latest 0.79 version of Storable::AMF added basic date support with the new_date() and perl_date() utilitiy functions. This is just great. Internally an AMF Date Type represents a timestamp in milliseconds since the epoch in UTC ("neutral") timezo...

 use Storable::AMF qw(new_date perl_date);

and make sure any date passed to an AMF::Connection as parameter is encoded with new_date().

=head2 OPEN ISSUES AND SHORTCOMINGS

There is still an issue when arbitrary Date structures are returned from an AMF server to an AMF::Connection (E.g. as part of values of structured AMF Objects). In this case, the AMF::Connection does not try to reparse the Perl object structure retur...

All this means that an AMF::Connection client application can not rely on those Date returned by the server as being Perl timestamps (seconds since the epoch) and will need explicitly call perl_date() or divide the timestamp by 1000 *explicitly*.

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

	my @int = unpack("n",$block);

	return $int[0];
	};

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

	my $double = $class->readBuffer(8);

	my @testEndian = unpack("C*",pack("S*",256));
        my $bigEndian = !$testEndian[1]==1;
        $double = reverse($double)
                if($bigEndian);
        my @double = unpack("d",$double);

        return $double[0];
	};

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

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

sub writeInt {
	my ($class, $int) = @_;

	$class->{'stream'}.=pack("n",$int);
	};

sub writeDouble {
	my ($class, $double) = @_;

        my $bin = pack("d",$double);
        my @testEndian = unpack("C*",pack("S*",256));
        my $bigEndian = !$testEndian[1]==1;
        $bin = reverse($bin)
                if ($bigEndian);

	$class->{'stream'}.=$bin;
	};

sub writeLong {
	my ($class, $long) = @_;

	$class->{'stream'}.=pack("N",$long);



( run in 1.616 second using v1.01-cache-2.11-cpan-f56aa216473 )