Badger::Codec::Storable

NAME

Top Close Open

Badger::Codec::Storable - encode/decode data using Storable

SYNOPSIS

Top Close Open
use Badger::Codec::Storable;

my $codec = Badger::Codec::Storable->new();
my $enc   = $codec->encode({ pi => 3.14, e => 2.718 });
my $dec   = $codec->decode($encoded);

DESCRIPTION

Top Close Open

This module implements a subclass of Badger::Codec which uses the freeze() and thaw() subroutines provided by the Storable module to encode and decode data.

It a very thin wrapper around the Storable module and offers no functional advantage over it. It exist only to provide a consistent API with other Badger::Codec modules.

METHODS

Top Close Open

encode($data)

Top Close Open

Encodes the data referenced by the first argument using freeze().

$encoded = Badger::Codec::Storable->encode($data);

decode($html)

Top Close Open

Decodes the encoded data passed as the first argument using thaw().

$decoded = Badger::Codec::Storable->decode($encoded);

encoder()

Top Close Open

This method returns a reference to the real subroutine that's doing all the encoding work, i.e. the freeze() method in Storable.

decoder()

Top Close Open

This method returns a reference to the real subroutine that's doing all the decoding work, i.e. the thaw() method in Storable.

AUTHOR

Top Close Open

Andy Wardley http://wardley.org/

COPYRIGHT

Top Close Open

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

Fork Me on Github