summaryrefslogtreecommitdiffstats
path: root/qooxdoo/source/perl/CGI/Session/Serialize
diff options
context:
space:
mode:
Diffstat (limited to 'qooxdoo/source/perl/CGI/Session/Serialize')
-rw-r--r--qooxdoo/source/perl/CGI/Session/Serialize/default.pm139
-rw-r--r--qooxdoo/source/perl/CGI/Session/Serialize/freezethaw.pm55
-rw-r--r--qooxdoo/source/perl/CGI/Session/Serialize/json.pm64
-rw-r--r--qooxdoo/source/perl/CGI/Session/Serialize/storable.pm60
-rw-r--r--qooxdoo/source/perl/CGI/Session/Serialize/yaml.pm67
5 files changed, 0 insertions, 385 deletions
diff --git a/qooxdoo/source/perl/CGI/Session/Serialize/default.pm b/qooxdoo/source/perl/CGI/Session/Serialize/default.pm
deleted file mode 100644
index a18c164..0000000
--- a/qooxdoo/source/perl/CGI/Session/Serialize/default.pm
+++ /dev/null
@@ -1,139 +0,0 @@
-package CGI::Session::Serialize::default;
-
-# $Id: default.pm 351 2006-11-24 14:16:50Z markstos $
-
-use strict;
-use Safe;
-use Data::Dumper;
-use CGI::Session::ErrorHandler;
-use Scalar::Util qw(blessed reftype refaddr);
-use Carp "croak";
-use vars qw( %overloaded );
-require overload;
-
-@CGI::Session::Serialize::default::ISA = ( "CGI::Session::ErrorHandler" );
-$CGI::Session::Serialize::default::VERSION = '4.20';
-
-
-sub freeze {
- my ($class, $data) = @_;
-
- my $d =
- new Data::Dumper([$data], ["D"]);
- $d->Indent( 0 );
- $d->Purity( 1 );
- $d->Useqq( 0 );
- $d->Deepcopy( 0 );
- $d->Quotekeys( 1 );
- $d->Terse( 0 );
-
- # ;$D added to make certain we get our data structure back when we thaw
- return $d->Dump() . ';$D';
-}
-
-sub thaw {
- my ($class, $string) = @_;
-
- # To make -T happy
- my ($safe_string) = $string =~ m/^(.*)$/s;
- my $rv = Safe->new->reval( $safe_string );
- if ( $@ ) {
- return $class->set_error("thaw(): couldn't thaw. $@");
- }
- __walk($rv);
- return $rv;
-}
-
-sub __walk {
- my %seen;
- my @filter = __scan(shift);
- local %overloaded;
-
- while (defined(my $x = shift @filter)) {
- $seen{refaddr $x || ''}++ and next;
-
- my $r = reftype $x or next;
- if ($r eq "HASH") {
- # we use this form to make certain we have aliases
- # to the values in %$x and not copies
- push @filter, __scan(@{$x}{keys %$x});
- } elsif ($r eq "ARRAY") {
- push @filter, __scan(@$x);
- } elsif ($r eq "SCALAR" || $r eq "REF") {
- push @filter, __scan($$x);
- }
- }
-}
-
-# we need to do this because the values we get back from the safe compartment
-# will have packages defined from the safe compartment's *main instead of
-# the one we use
-sub __scan {
- # $_ gets aliased to each value from @_ which are aliases of the values in
- # the current data structure
- for (@_) {
- if (blessed $_) {
- if (overload::Overloaded($_)) {
- my $address = refaddr $_;
-
- # if we already rebuilt and reblessed this item, use the cached
- # copy so our ds is consistent with the one we serialized
- if (exists $overloaded{$address}) {
- $_ = $overloaded{$address};
- } else {
- my $reftype = reftype $_;
- if ($reftype eq "HASH") {
- $_ = $overloaded{$address} = bless { %$_ }, ref $_;
- } elsif ($reftype eq "ARRAY") {
- $_ = $overloaded{$address} = bless [ @$_ ], ref $_;
- } elsif ($reftype eq "SCALAR" || $reftype eq "REF") {
- $_ = $overloaded{$address} = bless \do{my $o = $$_},ref $_;
- } else {
- croak "Do not know how to reconstitute blessed object of base type $reftype";
- }
- }
- } else {
- bless $_, ref $_;
- }
- }
- }
- return @_;
-}
-
-
-1;
-
-__END__;
-
-=pod
-
-=head1 NAME
-
-CGI::Session::Serialize::default - Default CGI::Session serializer
-
-=head1 DESCRIPTION
-
-This library is used by CGI::Session driver to serialize session data before storing it in disk.
-
-All the methods are called as class methods.
-
-=head1 METHODS
-
-=over 4
-
-=item freeze($class, \%hash)
-
-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()">
-
-=item thaw($class, $string)
-
-Received two arguments. First is the class name, second is the I<frozen> 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()">
-
-=back
-
-=head1 LICENSING
-
-For support and licensing see L<CGI::Session|CGI::Session>
-
-=cut
-
diff --git a/qooxdoo/source/perl/CGI/Session/Serialize/freezethaw.pm b/qooxdoo/source/perl/CGI/Session/Serialize/freezethaw.pm
deleted file mode 100644
index c71ece8..0000000
--- a/qooxdoo/source/perl/CGI/Session/Serialize/freezethaw.pm
+++ /dev/null
@@ -1,55 +0,0 @@
-package CGI::Session::Serialize::freezethaw;
-
-# $Id: freezethaw.pm 351 2006-11-24 14:16:50Z markstos $
-
-use strict;
-use FreezeThaw;
-use CGI::Session::ErrorHandler;
-
-$CGI::Session::Serialize::freezethaw::VERSION = 4.2;
-@CGI::Session::Serialize::freezethaw::ISA = ( "CGI::Session::ErrorHandler" );
-
-sub freeze {
- my ($self, $data) = @_;
- return FreezeThaw::freeze($data);
-}
-
-
-sub thaw {
- my ($self, $string) = @_;
- return (FreezeThaw::thaw($string))[0];
-}
-
-1;
-
-__END__;
-
-=pod
-
-=head1 NAME
-
-CGI::Session::Serialize::freezethaw - serializer for CGI::Session
-
-=head1 DESCRIPTION
-
-This library can be used by CGI::Session to serialize session data. Uses L<FreezeThaw|FreezeThaw>.
-
-=head1 METHODS
-
-=over 4
-
-=item freeze($class, \%hash)
-
-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()">
-
-=item thaw($class, $string)
-
-Received two arguments. First is the class name, second is the I<frozen> 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()">
-
-=back
-
-=head1 LICENSING
-
-For support and licensing see L<CGI::Session|CGI::Session>
-
-=cut
diff --git a/qooxdoo/source/perl/CGI/Session/Serialize/json.pm b/qooxdoo/source/perl/CGI/Session/Serialize/json.pm
deleted file mode 100644
index 2f8c8bb..0000000
--- a/qooxdoo/source/perl/CGI/Session/Serialize/json.pm
+++ /dev/null
@@ -1,64 +0,0 @@
-package CGI::Session::Serialize::json;
-
-use strict;
-use CGI::Session::ErrorHandler;
-
-$CGI::Session::Serialize::json::VERSION = '4.20';
-@CGI::Session::Serialize::json::ISA = ( "CGI::Session::ErrorHandler" );
-our $Flavour;
-
-unless($Flavour) {
- my $package = (grep { eval("use $_ (); 1;") } qw(JSON::Syck))[0]
- or die "JSON::Syck is required to use ", __PACKAGE__;
- $Flavour = $package;
-}
-
-sub freeze {
- my ($self, $data) = @_;
- return $Flavour->can('Dump')->($data);
-}
-
-
-sub thaw {
- my ($self, $string) = @_;
- return ($Flavour->can('Load')->($string))[0];
-}
-
-1;
-
-__END__;
-
-=pod
-
-=head1 NAME
-
-CGI::Session::Serialize::json - serializer for CGI::Session
-
-=head1 DESCRIPTION
-
-This library can be used by CGI::Session to serialize session data. Requires
-L<JSON::Syck|JSON::Syck>. JSON is a type of L<YAML|CGI::Session::Serialize::yaml>,
-with one extension: serialized JSON strings are actually valid JavaScript
-code that a browser can execute. Any langauge that has a YAML parser
-(Perl, PHP, Python, Ruby, C, etc) can also read data that has been serialized
-with JSON.
-
-=head1 METHODS
-
-=over 4
-
-=item freeze($class, \%hash)
-
-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()">
-
-=item thaw($class, $string)
-
-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()">
-
-=back
-
-=head1 SEE ALSO
-
-L<CGI::Session>, L<JSON::Syck>.
-
-=cut
diff --git a/qooxdoo/source/perl/CGI/Session/Serialize/storable.pm b/qooxdoo/source/perl/CGI/Session/Serialize/storable.pm
deleted file mode 100644
index 6ac2dae..0000000
--- a/qooxdoo/source/perl/CGI/Session/Serialize/storable.pm
+++ /dev/null
@@ -1,60 +0,0 @@
-package CGI::Session::Serialize::storable;
-
-# $Id: storable.pm 351 2006-11-24 14:16:50Z markstos $
-
-use strict;
-use Storable;
-require CGI::Session::ErrorHandler;
-
-$CGI::Session::Serialize::storable::VERSION = "4.20";
-@CGI::Session::Serialize::ISA = ( "CGI::Session::ErrorHandler" );
-
-=pod
-
-=head1 NAME
-
-CGI::Session::Serialize::storable - Serializer for CGI::Session
-
-=head1 DESCRIPTION
-
-This library can be used by CGI::Session to serialize session data. Uses L<Storable|Storable>.
-
-=head1 METHODS
-
-=over 4
-
-=item freeze($class, \%hash)
-
-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()">
-
-=cut
-
-sub freeze {
- my ($self, $data) = @_;
- return Storable::freeze($data);
-}
-
-=item thaw($class, $string)
-
-Receives two arguments. First is the class name, second is the I<frozen> 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()">
-
-=back
-
-=cut
-
-sub thaw {
- my ($self, $string) = @_;
- return Storable::thaw($string);
-}
-
-=head1 LICENSING
-
-For support and licensing see L<CGI::Session|CGI::Session>
-
-=cut
-
-1;
diff --git a/qooxdoo/source/perl/CGI/Session/Serialize/yaml.pm b/qooxdoo/source/perl/CGI/Session/Serialize/yaml.pm
deleted file mode 100644
index fd276d8..0000000
--- a/qooxdoo/source/perl/CGI/Session/Serialize/yaml.pm
+++ /dev/null
@@ -1,67 +0,0 @@
-package CGI::Session::Serialize::yaml;
-
-use strict;
-use CGI::Session::ErrorHandler;
-
-$CGI::Session::Serialize::yaml::VERSION = '4.20';
-@CGI::Session::Serialize::yaml::ISA = ( "CGI::Session::ErrorHandler" );
-our $Flavour;
-
-unless($Flavour) {
- my $package = (grep { eval("use $_ (); 1;") } qw(YAML::Syck YAML))[0]
- or die "Either YAML::Syck or YAML are required to use ", __PACKAGE__;
- $Flavour = $package;
-}
-
-sub freeze {
- my ($self, $data) = @_;
- return $Flavour->can('Dump')->($data);
-}
-
-
-sub thaw {
- my ($self, $string) = @_;
- return ($Flavour->can('Load')->($string))[0];
-}
-
-1;
-
-__END__;
-
-=pod
-
-=head1 NAME
-
-CGI::Session::Serialize::yaml - serializer for CGI::Session
-
-=head1 DESCRIPTION
-
-This library can be used by CGI::Session to serialize session data. It uses
-L<YAML|YAML>, or the faster C implementation, L<YAML::Syck|YAML::Syck>
-if it is available. YAML serializers exist not just for Perl but also other
-dynamic languages, such as PHP, Python, and Ruby, so storing session data
-in this format makes it easy to share session data across different languages.
-
-YAML is made to be friendly for humans to parse as well as other computer
-languages. It creates a format that is easier to read than the default
-serializer.
-
-=head1 METHODS
-
-=over 4
-
-=item freeze($class, \%hash)
-
-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()">
-
-=item thaw($class, $string)
-
-Received two arguments. First is the class name, second is the I<YAML> 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()">
-
-=back
-
-=head1 SEE ALSO
-
-L<CGI::Session>, L<YAML>, L<YAML::Syck>.
-
-=cut