data/TWiki/CGISessionSerializeJsonDotPm.txt,v
author Colas Nahaboo <colas@nahaboo.net>
Sat, 26 Jan 2008 15:50:53 +0100
changeset 0 414e01d06fd5
permissions -rw-r--r--
RELEASE 4.2.0 freetown
colas@0
     1
head	1.1;
colas@0
     2
access;
colas@0
     3
symbols;
colas@0
     4
locks; strict;
colas@0
     5
comment	@# @;
colas@0
     6
colas@0
     7
colas@0
     8
1.1
colas@0
     9
date	2008.01.22.03.21.29;	author TWikiContributor;	state Exp;
colas@0
    10
branches;
colas@0
    11
next	;
colas@0
    12
colas@0
    13
colas@0
    14
desc
colas@0
    15
@buildrelease
colas@0
    16
@
colas@0
    17
colas@0
    18
colas@0
    19
1.1
colas@0
    20
log
colas@0
    21
@buildrelease
colas@0
    22
@
colas@0
    23
text
colas@0
    24
@---+ Package ==
colas@0
    25
colas@0
    26
%TOC%
colas@0
    27
=head1 NAME
colas@0
    28
colas@0
    29
CGI::Session::Serialize::json - serializer for CGI::Session
colas@0
    30
colas@0
    31
=head1 DESCRIPTION
colas@0
    32
colas@0
    33
This library can be used by CGI::Session to serialize session data. Requires
colas@0
    34
L<JSON::Syck|JSON::Syck>. JSON is a type of L<YAML|CGI::Session::Serialize::yaml>,
colas@0
    35
with one extension: serialized JSON strings are actually valid JavaScript
colas@0
    36
code that a browser can execute. Any langauge that has a YAML parser
colas@0
    37
(Perl, PHP, Python, Ruby, C, etc) can also read data that has been serialized
colas@0
    38
with JSON.
colas@0
    39
colas@0
    40
=head1 METHODS
colas@0
    41
colas@0
    42
=over 4
colas@0
    43
colas@0
    44
=item freeze($class, \%hash)
colas@0
    45
colas@0
    46
Receives two arguments. First is the class name, the second is the data to be serialized. Should return serialized string on success, undef on failure. Error message should be set using C<set_error()|CGI::Session::ErrorHandler/"set_error()">
colas@0
    47
colas@0
    48
=item thaw($class, $string)
colas@0
    49
colas@0
    50
Received two arguments. First is the class name, second is the I<JSON> data string. Should return thawed data structure on success, undef on failure. Error message should be set using C<set_error()|CGI::Session::ErrorHandler/"set_error()">
colas@0
    51
colas@0
    52
=back
colas@0
    53
colas@0
    54
=head1 SEE ALSO
colas@0
    55
colas@0
    56
L<CGI::Session>, L<JSON::Syck>.
colas@0
    57
colas@0
    58
@