| 1 | package WWW::Session::Serialization::Storable; | ||
| 2 | |||
| 3 | 3 | ▶ | use 5.006; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 3 | ▶ | use Storable qw(freeze thaw); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | WWW::Session::Serialization::Storable - Serialization module for WWW::Session with Storable backend | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | Storable serialization engine for WWW::Session objects | ||
| 16 | |||
| 17 | =head1 VERSION | ||
| 18 | |||
| 19 | Version 0.12 | ||
| 20 | |||
| 21 | =cut | ||
| 22 | |||
| 23 | 3 | our $VERSION = '0.12'; | |
| 24 | |||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | This module handles serialization for WWW::Session objects using Storable. | ||
| 29 | |||
| 30 | This module can serialize complex structures wich contain objects. | ||
| 31 | |||
| 32 | The object implements two main methods : serialize() and expand() | ||
| 33 | |||
| 34 | use WWW::Session::Serialization::Storable; | ||
| 35 | |||
| 36 | my $foo = WWW::Session::Serialization::Storable->new(); | ||
| 37 | ... | ||
| 38 | |||
| 39 | $string = $serializer->serialize($structure); | ||
| 40 | |||
| 41 | ... | ||
| 42 | $structure = $serializer->expand($string); | ||
| 43 | |||
| 44 | =head1 SUBROUTINES/METHODS | ||
| 45 | |||
| 46 | =head2 new | ||
| 47 | |||
| 48 | Creates a new WWW::Session::Serialization::Storable object | ||
| 49 | |||
| 50 | Usage : | ||
| 51 | |||
| 52 | my $serializer = WWW::Session::Serialization::Storable->new(); | ||
| 53 | |||
| 54 | No arguments required. | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | 1 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 59 | 1 | my $class = shift; | |
| 60 | |||
| 61 | 1 | my $self = {}; | |
| 62 | |||
| 63 | 1 | bless $self,$class; | |
| 64 | |||
| 65 | 1 | return $self; | |
| 66 | } | ||
| 67 | |||
| 68 | =head2 serialize | ||
| 69 | |||
| 70 | Serializes a structure and returns a binary string containing all the data | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | 1 | ▶ | sub serialize { |
|
Subroutine
serialize: called CC=1 SCAR=0.0
Pod
documented
| |||
| 75 | 1 | my ($self,$data) = @_; | |
| 76 | |||
| 77 | 1 | return freeze($data); | |
| 78 | } | ||
| 79 | |||
| 80 | |||
| 81 | =head2 expand | ||
| 82 | |||
| 83 | Deserializes binary string and returns a structure containing all the data | ||
| 84 | |||
| 85 | =cut | ||
| 86 | 1 | ▶ | sub expand { |
|
Subroutine
expand: called CC=1 SCAR=0.0
Pod
documented
| |||
| 87 | 1 | my ($self,$string) = @_; | |
| 88 | |||
| 89 | 1 | return thaw($string); | |
| 90 | } | ||
| 91 | =head1 AUTHOR | ||
| 92 | |||
| 93 | Gligan Calin Horea, C<< <gliganh at gmail.com> >> | ||
| 94 | |||
| 95 | =head1 BUGS | ||
| 96 | |||
| 97 | Please report any bugs or feature requests to C<bug-www-session at rt.cpan.org>, or through | ||
| 98 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Session>. I will be notified, and then you'll | ||
| 99 | automatically be notified of progress on your bug as I make changes. | ||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | =head1 SUPPORT | ||
| 105 | |||
| 106 | You can find documentation for this module with the perldoc command. | ||
| 107 | |||
| 108 | perldoc WWW::Session::Serialization::Storable | ||
| 109 | |||
| 110 | |||
| 111 | You can also look for information at: | ||
| 112 | |||
| 113 | =over 4 | ||
| 114 | |||
| 115 | =item * RT: CPAN's request tracker (report bugs here) | ||
| 116 | |||
| 117 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Session> | ||
| 118 | |||
| 119 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 120 | |||
| 121 | L<http://annocpan.org/dist/WWW-Session> | ||
| 122 | |||
| 123 | =item * CPAN Ratings | ||
| 124 | |||
| 125 | L<http://cpanratings.perl.org/d/WWW-Session> | ||
| 126 | |||
| 127 | =item * Search CPAN | ||
| 128 | |||
| 129 | L<http://search.cpan.org/dist/WWW-Session/> | ||
| 130 | |||
| 131 | =back | ||
| 132 | |||
| 133 | |||
| 134 | =head1 ACKNOWLEDGEMENTS | ||
| 135 | |||
| 136 | |||
| 137 | =head1 LICENSE AND COPYRIGHT | ||
| 138 | |||
| 139 | Copyright 2012 Gligan Calin Horea. | ||
| 140 | |||
| 141 | This program is free software; you can redistribute it and/or modify it | ||
| 142 | under the terms of either: the GNU General Public License as published | ||
| 143 | by the Free Software Foundation; or the Artistic License. | ||
| 144 | |||
| 145 | See http://dev.perl.org/licenses/ for more information. | ||
| 146 | |||
| 147 | |||
| 148 | =cut | ||
| 149 | |||
| 150 | 3 | 1; # End of WWW::Session::Serialization::Storable | |