GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Badger::Codec::Chain(3) User Contributed Perl Documentation Badger::Codec::Chain(3)

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

    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);

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

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');

Encodes the data referenced by the first argument using all the codecs in the chain.

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

Decodes the encoded data passed as the first argument using all the codecs in the chain in reverse order.

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

Returns a reference to a subroutine which performs the encoding operation.

Returns a reference to a subroutine which performs the decoding operation.

Internal method to construct an encoder or decoder subroutine for a codec chain.

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

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

Badger::Codecs, Badger::Codec.
2016-12-12 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.