[Affelio-cvs 110] CVS update: affelio/extlib/auto/CGI/Session

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 6月 21日 (火) 23:58:47 JST


Index: affelio/extlib/auto/CGI/Session/_time_alias.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/_time_alias.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/_time_alias.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,34 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1159 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/_time_alias.al)"
+# parses such strings as '+1M', '+3w', accepted by expire()
+sub _time_alias {
+    my ($str) = @_;
+
+    # If $str consists of just digits, return them as they are
+    if ( $str =~ m/^\d+$/ ) {
+        return $str;
+    }
+
+    my %time_map = (
+        s           => 1,
+        m           => 60,
+        h           => 3600,
+        d           => 86400,
+        w           => 604800,
+        M           => 2592000,
+        y           => 31536000
+    );
+
+    my ($koef, $d) = $str =~ m/^([+-]?\d+)(\w)$/;
+
+    if ( defined($koef) && defined($d) ) {
+        return $koef * $time_map{$d};
+    }
+}
+
+# end of CGI::Session::_time_alias
+1;
Index: affelio/extlib/auto/CGI/Session/atime.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/atime.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/atime.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,19 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1099 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/atime.al)"
+# atime() - rerturns session last access time
+sub atime {
+    my $self = shift;
+
+    if ( @_ ) {
+        confess "_SESSION_ATIME - read-only value";
+    }
+
+    return $self->{_DATA}->{_SESSION_ATIME};
+}
+
+# end of CGI::Session::atime
+1;
Index: affelio/extlib/auto/CGI/Session/autosplit.ix
diff -u /dev/null affelio/extlib/auto/CGI/Session/autosplit.ix:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/autosplit.ix	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,24 @@
+# Index created by AutoSplit for blib/lib/CGI/Session.pm
+#    (file acts as timestamp)
+package CGI::Session;
+sub dump  ;
+sub version  ;
+sub delete  ;
+sub clear  ;
+sub save_param  ;
+sub load_param  ;
+sub close  ;
+sub error  ;
+sub errstr  ;
+sub atime  ;
+sub ctime  ;
+sub expire  ;
+sub expires  ;
+sub _time_alias  ;
+sub remote_addr  ;
+sub param_hashref  ;
+sub name  ;
+sub header  ;
+sub sync_param  ;
+sub is_new  ;
+1;
Index: affelio/extlib/auto/CGI/Session/clear.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/clear.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/clear.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,40 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 950 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/clear.al)"
+# clear() - clears a list of parameters off the session's '_DATA' table
+sub clear {
+    my $self = shift;
+    $class   = ref($self);
+    
+    my @params = ();
+
+    # if there was at least one argument, we take it as a list
+    # of params to delete
+    if ( @_ ) {
+	@params = ref($_[0]) ? @{ $_[0] } : ($_[0]);
+    } else {
+	@params = $self->param();
+    }
+
+    my $n = 0;
+    for ( @params ) {
+        /^_SESSION_/ and next;
+        # If this particular parameter has an expiration ticker,
+        # remove it.
+        if ( $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} ) {
+            delete ( $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$_} );
+        }
+        delete ($self->{_DATA}->{$_}) && ++$n;
+    }
+
+    # Set the session '_STATUS' flag to MODIFIED
+    $self->{_STATUS} = MODIFIED;
+
+    return $n;
+}
+
+# end of CGI::Session::clear
+1;
Index: affelio/extlib/auto/CGI/Session/close.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/close.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/close.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,16 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1068 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/close.al)"
+# another, but a less efficient alternative to undefining
+# the object
+sub close {
+    my $self = shift;
+
+    $self->DESTROY();
+}
+
+# end of CGI::Session::close
+1;
Index: affelio/extlib/auto/CGI/Session/ctime.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/ctime.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/ctime.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,19 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1111 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/ctime.al)"
+# ctime() - returns session creation time
+sub ctime {
+    my $self = shift;
+
+    if ( @_ ) {
+        confess "_SESSION_ATIME - read-only value";
+    }
+
+    return $self->{_DATA}->{_SESSION_CTIME};
+}
+
+# end of CGI::Session::ctime
+1;
Index: affelio/extlib/auto/CGI/Session/delete.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/delete.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/delete.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,19 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 935 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/delete.al)"
+sub delete {
+    my $self = shift;
+
+    # If it was already deleted, make a confession!
+    if ( $self->{_STATUS} == DELETED ) {
+        confess "delete attempt on deleted session";
+    }
+
+    $self->{_STATUS} = DELETED;
+}
+
+# end of CGI::Session::delete
+1;
Index: affelio/extlib/auto/CGI/Session/dump.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/dump.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/dump.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,37 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 899 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/dump.al)"
+# $Id: dump.al,v 1.1 2005/06/21 14:58:47 slash5234 Exp $
+
+
+# dump() - dumps the session object using Data::Dumper.
+# during development it defines global dump().
+sub dump {
+    my ($self, $file, $indent) = @_;
+
+    require Data::Dumper;
+    local $Data::Dumper::Indent = $indent || 2;    
+
+    my $d = new Data::Dumper([$self], [ref $self]);
+
+    if ( defined $file ) {
+        unless ( open(FH, '<' . $file) ) {
+            unless(open(FH, '>' . $file)) {
+                $self->error("Couldn't open $file: $!");
+                return undef;
+            }
+            print FH $d->Dump();
+            unless ( CORE::close(FH) ) {
+                $self->error("Couldn't dump into $file: $!");
+                return undef;
+            }
+        }
+    }
+    return $d->Dump();
+}
+
+# end of CGI::Session::dump
+1;
Index: affelio/extlib/auto/CGI/Session/error.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/error.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/error.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,19 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1078 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/error.al)"
+# error() returns/sets error message
+sub error {
+    my ($self, $msg) = @_;
+
+    if ( defined $msg ) {
+        $errstr = $msg;
+    }
+
+    return $errstr;
+}
+
+# end of CGI::Session::error
+1;
Index: affelio/extlib/auto/CGI/Session/errstr.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/errstr.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/errstr.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,15 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1090 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/errstr.al)"
+# errstr() - alias to error()
+sub errstr {
+    my $self = shift;
+
+    return $self->error(@_);
+}
+
+# end of CGI::Session::errstr
+1;
Index: affelio/extlib/auto/CGI/Session/expire.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/expire.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/expire.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,37 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1123 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/expire.al)"
+# expire() - sets/returns session/parameter expiration ticker
+sub expire {
+    my $self = shift;
+
+    unless ( @_ ) {
+        return $self->{_DATA}->{_SESSION_ETIME};
+    }
+
+    if ( @_ == 1 ) {
+        return $self->{_DATA}->{_SESSION_ETIME} = _time_alias( $_[0] );
+    }
+
+    # If we came this far, we'll simply assume user is trying
+    # to set an expiration date for a single session parameter.
+    my ($param, $etime) = @_;
+
+    # Let's check if that particular session parameter exists
+    # in the '_DATA' table. Otherwise, return now!
+    defined ($self->{_DATA}->{$param} ) || return;
+
+    if ( $etime eq '-1' ) {
+        delete $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$param};
+	$self->{_STATUS} = MODIFIED;
+        return;
+    }
+
+    $self->{_DATA}->{_SESSION_EXPIRE_LIST}->{$param} = _time_alias( $etime );
+}
+
+# end of CGI::Session::expire
+1;
Index: affelio/extlib/auto/CGI/Session/expires.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/expires.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/expires.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,13 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1153 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/expires.al)"
+# expires() - alias to expire(). For backward compatibility
+sub expires {
+	return expire(@_);
+}
+
+# end of CGI::Session::expires
+1;
Index: affelio/extlib/auto/CGI/Session/header.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/header.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/header.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,28 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1214 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/header.al)"
+# header() - replacement for CGI::header() method
+sub header {
+    my $self = shift;
+
+    my $cgi = $self->{_SESSION_OBJ};
+    unless ( defined $cgi ) {
+        require CGI;
+        $self->{_SESSION_OBJ} = CGI->new();
+        return $self->header();
+    }
+
+    my $cookie = $cgi->cookie($self->name(), $self->id() );
+
+    return $cgi->header(
+        -type   => 'text/html',
+        -cookie => $cookie,
+        @_
+    );
+}
+
+# end of CGI::Session::header
+1;
Index: affelio/extlib/auto/CGI/Session/is_new.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/is_new.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/is_new.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,16 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1256 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/is_new.al)"
+# to Chris Dolan's request
+sub is_new {
+	my $self = shift;
+
+	return $self->{_IS_NEW};
+}
+
+# $Id: is_new.al,v 1.1 2005/06/21 14:58:47 slash5234 Exp $
+1;
+# end of CGI::Session::is_new
Index: affelio/extlib/auto/CGI/Session/load_param.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/load_param.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/load_param.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,41 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1032 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/load_param.al)"
+# load_param() - loads a list of third party object parameters
+# such as CGI, into CGI::Session's '_DATA' table
+sub load_param {
+    my ($self, $cgi, $list) = @_;
+
+    unless ( ref($cgi) ) {
+        confess "save_param(): first argument must be an object";
+
+    }
+    unless ( $cgi->can('param') ) {
+        my $class = ref($cgi);
+        confess "save_param(): Cannot call method param() on the object $class";
+    }
+
+    my @params = ();
+    if ( defined $list ) {
+        unless ( ref($list) eq 'ARRAY' ) {
+            confess "save_param(): second argument must be an arrayref";
+        }
+        @params = @{ $list };
+
+    } else {
+        @params = $self->param();
+
+    }
+
+    my $n = 0;
+    for ( @params ) {
+        $cgi->param(-name=>$_, -value=>$self->_get_param($_));
+    }
+    return $n;
+}
+
+# end of CGI::Session::load_param
+1;
Index: affelio/extlib/auto/CGI/Session/name.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/name.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/name.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,19 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1202 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/name.al)"
+# name() - returns the cookie name associated with the session id
+sub name {
+    my ($class, $name)  = @_;
+
+    if ( defined $name ) {
+        $CGI::Session::NAME = $name;
+    }
+
+    return $CGI::Session::NAME;
+}
+
+# end of CGI::Session::name
+1;
Index: affelio/extlib/auto/CGI/Session/param_hashref.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/param_hashref.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/param_hashref.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,15 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1194 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/param_hashref.al)"
+# param_hashref() - returns parameters as a reference to a hash
+sub param_hashref {
+    my $self = shift;
+
+    return $self->{_DATA};
+}
+
+# end of CGI::Session::param_hashref
+1;
Index: affelio/extlib/auto/CGI/Session/remote_addr.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/remote_addr.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/remote_addr.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,15 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1186 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/remote_addr.al)"
+# remote_addr() - returns ip address of the session
+sub remote_addr {
+    my $self = shift;
+
+    return $self->{_DATA}->{_SESSION_REMOTE_ADDR};
+}
+
+# end of CGI::Session::remote_addr
+1;
Index: affelio/extlib/auto/CGI/Session/save_param.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/save_param.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/save_param.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,56 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 983 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/save_param.al)"
+# save_param() - copies a list of third party object parameters
+# into CGI::Session object's '_DATA' table
+sub save_param {
+    my ($self, $cgi, $list) = @_;
+
+    unless ( ref($cgi) ) {
+        confess "save_param(): first argument should be an object";
+
+    }
+    unless ( $cgi->can('param') ) {
+        confess "save_param(): Cannot call method param() on the object";
+    }
+
+    my @params = ();
+    if ( defined $list ) {
+        unless ( ref($list) eq 'ARRAY' ) {
+            confess "save_param(): second argument must be an arrayref";
+        }
+
+        @params = @{ $list };
+
+    } else {
+        @params = $cgi->param();
+
+    }
+
+    my $n = 0;
+    for ( @params ) {
+        # It's imporatnt to note that CGI.pm's param() returns array
+        # if a parameter has more values associated with it (checkboxes
+        # and crolling lists). So we should access its parameters in
+        # array context not to miss anything
+        my @values = $cgi->param($_);
+
+        if ( defined $values[1] ) {
+            $self->_set_param($_ => \@values);
+
+        } else {
+            $self->_set_param($_ => $values[0] );
+
+        }
+
+        ++$n;
+    }
+
+    return $n;
+}
+
+# end of CGI::Session::save_param
+1;
Index: affelio/extlib/auto/CGI/Session/sync_param.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/sync_param.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/sync_param.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,28 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 1235 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/sync_param.al)"
+# sync_param() - synchronizes CGI and Session parameters.
+sub sync_param {
+    my ($self, $cgi, $list) = @_;
+
+    unless ( ref($cgi) ) {
+        confess("$cgi doesn't look like an object");
+    }
+
+    unless ( $cgi->UNIVERSAL::can('param') ) {
+        confess(ref($cgi) . " doesn't support param() method");
+    }
+
+    # we first need to save all the available CGI parameters to the
+    # object
+    $self->save_param($cgi, $list);
+
+    # we now need to load all the parameters back to the CGI object
+    return $self->load_param($cgi, $list);
+}
+
+# end of CGI::Session::sync_param
+1;
Index: affelio/extlib/auto/CGI/Session/version.al
diff -u /dev/null affelio/extlib/auto/CGI/Session/version.al:1.1
--- /dev/null	Tue Jun 21 23:58:47 2005
+++ affelio/extlib/auto/CGI/Session/version.al	Tue Jun 21 23:58:47 2005
@@ -0,0 +1,13 @@
+# NOTE: Derived from blib/lib/CGI/Session.pm.
+# Changes made here will be lost when autosplit is run again.
+# See AutoSplit.pm.
+package CGI::Session;
+
+#line 930 "blib/lib/CGI/Session.pm (autosplit into blib/lib/auto/CGI/Session/version.al)"
+sub version {   return $VERSION   }
+
+
+# delete() - sets the '_STATUS' session flag to DELETED,
+# which flush() uses to decide to call remove() method on driver.
+# end of CGI::Session::version
+1;


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