Andy Wardley > Badger-0.01 > Badger::Codec::JSON

Download:
Badger-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source   Latest Release: Badger-0.06_01

NAME ^

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

SYNOPSIS ^

    use Badger::Codec::JSON;
    my $codec   = Badger::Codec::JSON->new();
    my $encoded = $codec->encode({ msg => "Hello World" });
    my $decoded = $codec->decode($encoded);

DESCRIPTION ^

This module implements a subclass of Badger::Codec which uses the JSON module to encode and decode data to and from JSON.

METHODS ^

encode($data)

Encodes $data to JSON.

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

decode($data)

Decodes $data from JSON.

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

encoder()

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

decoder()

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

AUTHOR ^

Andy Wardley <abw@wardley.org>

COPYRIGHT ^

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

SEE ALSO ^

Badger::Codecs, Badger::Codec, JSON