| Data-AMF documentation | Contained in the Data-AMF distribution. |
Data::AMF - serialize / deserialize AMF data
use Data::AMF;
my $amf0 = Data::AMF->new( version => 0 );
my $amf3 = Data::AMF->new( version => 3 );
# AMF0 to Perl Object
my $obj = $amf0->deserialize($data);
# Perl Object to AMF0
my $data = $amf0->serialize($obj);
This module is (de)serializer for Adobe's AMF (Action Message Format). Data::AMF is core module and it recognize only AMF data, not AMF packet. If you want to read/write AMF Packet, see Data::AMF::Packet instead.
Data::AMF is currently in a very early alpha development stage. The current version is not support AMF3, and application interface is still fluid.
Create Data::AMF object.
Option parameters are:
Target AMF version.
It should be 0 or 3. (default 0 for AMF0)
Serialize perl object ($obj) to AMF, and return the AMF data.
Deserialize AMF data to perl object, and return the perl object.
Daisuke Murase <typester@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
| Data-AMF documentation | Contained in the Data-AMF distribution. |
package Data::AMF; use 5.008001; use Any::Moose; our $VERSION = '0.09'; use Data::AMF::Parser; use Data::AMF::Formatter; has version => ( is => 'rw', isa => 'Int', default => sub { 0 }, ); has parser => ( is => 'rw', lazy => 1, default => sub { my $self = shift; Data::AMF::Parser->new( version => $self->version ); }, ); has formatter => ( is => 'rw', lazy => 1, default => sub { my $self = shift; Data::AMF::Formatter->new( version => $self->version ); }, ); no Any::Moose; sub serialize { my $self = shift; $self->formatter->format(@_); } sub deserialize { my $self = shift; $self->parser->parse(@_); } __PACKAGE__->meta->make_immutable; __END__