Data-Encoder

 view release on metacpan or  search on metacpan

lib/Data/Encoder.pm  view on Meta::CPAN

    return $class;
}

1;
__END__

=encoding utf-8

=for stopwords

=head1 NAME

Data::Encoder - Generic interface for perl encoder or serializer

=head1 SYNOPSIS

  use Data::Encoder;

  my $encoder = Data::Encoder->load('JSON');
  my $json = $encoder->encode(['foo']);
  my $data = $encoder->decode($json);

=head1 DESCRIPTION

Data::Encoder is generic interface for perl encoder or serializer

This module is inspired L<Tiffany>

THIS MODULE IS IN ITS BETA QUALITY. THE API IS STOLEN FROM TILT BUT MAY CHANGE IN THE FUTURE.

=head1 FACTORY METHOD

Data::Encoder.pm acts as a factory for Data::Encoder::* classes, which in turn are the actual adapter classes for each encoder.

=over 4

=item 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' });

=back

=head1 The Data::Encoder Protocol

=over 4

=item my $encoder = Data::Encoder::Thing->new([$args:HashRef|ArrayRef])

The module SHOULD have a C<<new>> method.

This method creates a new instance of Data::Encoder module.

=item my $encoded = $encoder->encode($stuff [, @args]);

The module SHOULD have a C<<encode>> method.

=item my $decoded = $encoder->decode($stuff [, @args]);

The module SHOULD have a C<<decod>> method.

=back

=head1 AUTHOR

xaicron E<lt>xaicron {at} cpan.orgE<gt>

=head1 THANKS TO

zigorou

tokuhirom

kazuhooku

=head1 COPYRIGHT

Copyright 2010 - xaicron

=head1 LICENSE

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=head1 SEE ALSO

=cut



( run in 1.140 second using v1.01-cache-2.11-cpan-e1769b4cff6 )