[Affelio-cvs 976] CVS update: affelio/extlib/CGI/Session/Serialize

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 12月 20日 (火) 01:39:33 JST


Index: affelio/extlib/CGI/Session/Serialize/default.pm
diff -u affelio/extlib/CGI/Session/Serialize/default.pm:1.1 affelio/extlib/CGI/Session/Serialize/default.pm:removed
--- affelio/extlib/CGI/Session/Serialize/default.pm:1.1	Sun Dec 18 14:16:46 2005
+++ affelio/extlib/CGI/Session/Serialize/default.pm	Tue Dec 20 01:39:33 2005
@@ -1,118 +0,0 @@
-package CGI::Session::Serialize::default;
-
-# $Id: default.pm,v 1.1 2005/12/18 05:16:46 slash5234 Exp $ 
-
-use strict;
-use Safe;
-use Data::Dumper;
-use CGI::Session::ErrorHandler;
-use Scalar::Util qw(blessed reftype refaddr);
-use Carp "croak";
-
- @ CGI::Session::Serialize::default::ISA = ( "CGI::Session::ErrorHandler" );
-$CGI::Session::Serialize::default::VERSION = '1.5';
-
-
-sub freeze {
-    my ($class, $data) = @_;
-    
-    my $d = new Data::Dumper([$data], ["D"]);
-    $d->Indent( 0 );
-    $d->Purity( 0 );
-    $d->Useqq( 0 );
-    $d->Deepcopy( 1 );
-    $d->Quotekeys( 0 );
-    $d->Terse( 0 );
-    return $d->Dump();
-}
-
-sub thaw {
-    my ($class, $string) = @_;
-
-    # To make -T happy
-     my ($safe_string) = $string =~ m/^(.*)$/s;
-     my $rv = Safe->new->reval( $safe_string );
-    if ( my $errmsg = $@ ) {
-        return $class->set_error("thaw(): couldn't thaw. $@");
-    }
-    __walk($rv);
-    return $rv;
-}
-
-sub __walk {
-    my %seen;
-    my @filter = shift;
-    
-    while (defined(my $x = shift @filter)) {
-        $seen{refaddr $x || ''}++ and next;
-          
-        my $r = reftype $x or next;
-        if ($r eq "HASH") {
-            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);
-        }
-    }
-}
-
-sub __scan {
-    for (@_) {
-        if (blessed $_) {
-            if (overload::Overloaded($_)) {
-                my $r = reftype $_;
-                if ($r eq "HASH") {
-                    $_ = bless { %$_ }, ref $_;
-                } elsif ($r eq "ARRAY") {
-                    $_ = bless [ @$_ ], ref $_;
-                } elsif ($r eq "SCALAR" || $r eq "REF") {
-                    $_ = bless \do{my $o = $$_},ref $_;
-                } else {
-                    croak "Do not know how to reconstitute blessed object of base type $r";
-                }
-            } 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
-
Index: affelio/extlib/CGI/Session/Serialize/freezethaw.pm
diff -u affelio/extlib/CGI/Session/Serialize/freezethaw.pm:1.1 affelio/extlib/CGI/Session/Serialize/freezethaw.pm:removed
--- affelio/extlib/CGI/Session/Serialize/freezethaw.pm:1.1	Sun Dec 18 14:16:46 2005
+++ affelio/extlib/CGI/Session/Serialize/freezethaw.pm	Tue Dec 20 01:39:33 2005
@@ -1,55 +0,0 @@
-package CGI::Session::Serialize::freezethaw;
-
-# $Id: freezethaw.pm,v 1.1 2005/12/18 05:16:46 slash5234 Exp $ 
-
-use strict;
-use FreezeThaw;
-use CGI::Session::ErrorHandler;
-
-$CGI::Session::Serialize::freezethaw::VERSION = '1.6';
- @ 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
Index: affelio/extlib/CGI/Session/Serialize/storable.pm
diff -u affelio/extlib/CGI/Session/Serialize/storable.pm:1.1 affelio/extlib/CGI/Session/Serialize/storable.pm:removed
--- affelio/extlib/CGI/Session/Serialize/storable.pm:1.1	Sun Dec 18 14:16:46 2005
+++ affelio/extlib/CGI/Session/Serialize/storable.pm	Tue Dec 20 01:39:33 2005
@@ -1,60 +0,0 @@
-package CGI::Session::Serialize::storable;
-
-# $Id: storable.pm,v 1.1 2005/12/18 05:16:46 slash5234 Exp $
-
-use strict;
-use Storable;
-require CGI::Session::ErrorHandler;
-
-$CGI::Session::Serialize::storable::VERSION = "1.5";
- @ 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;


Affelio-cvs メーリングリストの案内
Back to archive index