Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Badger::Codec::Chain(3User Contributed Perl DocumentatiBadger::Codec::Chain(3)

NAME
       Badger::Codec::Chain - encode/decode data using multiple	codecs

SYNOPSIS
	   use Badger::Codec::Chain;

	   # compact form
	   my $codec = Badger::Codec::Chain->new('storable+base64');

	   # explicit form
	   my $codec = Badger::Codec::Chain->new('storable', 'base64');

	   # encode/decode data	using codec chain
	   my $enc   = $codec->encode({	pi => 3.14, e => 2.718 });
	   my $dec   = $codec->decode($encoded);

DESCRIPTION
       This module implements a	subclass of Badger::Codec which	chains
       together	any number of other codec modules.

METHODS
   new(@codecs)
       Constructor method to create a new codec	chain.	The codecs can be
       specified by name or as references to Badger::Codec objects.

	   # by	name
	   my $codec = Badger::Codec::Chain->new('storable', 'base64');

	   # by	object reference
	   my $codec = Badger::Codec::Chain->new(
	       Badger::Codec->codec('storable'),
	       Badger::Codec->codec('base64'),
	   );

       You can also use	the compact form where multiple	codec names are
       separated by "+".

	   # compact form
	   my $codec = Badger::Codec::Chain->new('storable+base64');

   encode($data)
       Encodes the data	referenced by the first	argument using all the codecs
       in the chain.

	   $encoded = $codec->encode($data);

   decode($html)
       Decodes the encoded data	passed as the first argument using all the
       codecs in the chain in reverse order.

	   $decoded = $codec->decode($encoded);

   encoder()
       Returns a reference to a	subroutine which performs the encoding
       operation.

   decoder()
       Returns a reference to a	subroutine which performs the decoding
       operation.

INTERNAL METHODS
   coder(@coders)
       Internal	method to construct an encoder or decoder subroutine for a
       codec chain.

AUTHOR
       Andy Wardley <http://wardley.org/>

COPYRIGHT
       Copyright (C) 2005-2009 Andy Wardley. All rights	reserved.

SEE ALSO
       Badger::Codecs, Badger::Codec.

perl v5.32.0			  2016-12-12	       Badger::Codec::Chain(3)

NAME | SYNOPSIS | DESCRIPTION | METHODS | INTERNAL METHODS | AUTHOR | COPYRIGHT | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Badger::Codec::Chain&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help