NAME
Data::Encoder - Generic interface for perl encoder or serializer
SYNOPSIS
use Data::Encoder;
my $encoder = Data::Encoder->load('JSON');
my $json = $encoder->encode(['foo']);
my $data = $encoder->decode($json);
DESCRIPTION
Data::Encoder is generic interface for perl encoder or serializer
This module is inspired Tiffany
THIS MODULE IS IN ITS BETA QUALITY. THE API IS STOLEN FROM TILT BUT MAY CHANGE IN THE FUTURE.
FACTORY METHOD
Data::Encoder.pm acts as a factory for Data::Encoder::* classes, which in turn are the actual adapter classes for each encoder.
- my $encoder = Data::Encoder->load($klass, $args)
-
Load Data::Encoder::* class if necessary, and create new instance of using the given arguments.
my $encoder = Data::Encoder->load('JSON', +{ utf8 => 1, pretty => 1 }); my $encoder = Data::Encoder->load('+My::Encoder', +{ option => 'foo' });
The Data::Encoder Protocol
- my $encoder = Data::Encoder::Thing->new([$args:HashRef|ArrayRef])
-
The module SHOULD have a
<new
> method.This method creates a new instance of Data::Encoder module.
- my $encoded = $encoder->encode($stuff [, @args]);
-
The module SHOULD have a
<encode
> method. - my $decoded = $encoder->decode($stuff [, @args]);
-
The module SHOULD have a
<decod
> method.
AUTHOR
xaicron <xaicron {at} cpan.org>
THANKS TO
zigorou
tokuhirom
kazuhooku
COPYRIGHT
Copyright 2010 - xaicron
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.