[svn:p5ee] r3602 - p5ee/trunk/App-Context/lib/App

[email protected]
Newsgroups perl.cvs.p5ee
Message-ID <[email protected]>
Author: spadkins
Date: Sat Mar  4 21:11:10 2006
New Revision: 3602

Modified:
   p5ee/trunk/App-Context/lib/App/Context.pm

Log:
minor fixes to so_get()/so_set()

Modified: p5ee/trunk/App-Context/lib/App/Context.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context.pm	(original)
+++ p5ee/trunk/App-Context/lib/App/Context.pm	Sat Mar  4 21:11:10 2006
@@ -871,7 +871,10 @@
             $value = $default;
             if ($setdefault) {
                 $self->{session}{store}{SessionObject}{$name}{$var} = $value;
-                $self->session_object($name) if (!defined $self->{session}{cache}{SessionObject}{$name});
+                my $cached_service = $self->{session}{cache}{SessionObject}{$name};
+                if (!defined $cached_service || ref($cached_service) eq "HASH") {
+                    $self->session_object($name);
+                }
                 $self->{session}{cache}{SessionObject}{$name}{$var} = $value;
             }
         }
@@ -979,16 +982,16 @@
         elsif ($var =~ /^\{([^\}]+)\}$/) {  # a simple "{foo-bar}"
             $var = $1;
             $self->{session}{store}{SessionObject}{$name}{$var} = $value;
-            $self->{session}{cache}{SessionObject}{$name}{$var} = $value
-                if (defined $self->{session}{cache}{SessionObject}{$name});
+            $self->{session}{cache}{SessionObject}{$name}{$var} = $value;
+                # ... we used to only set the cache attribute when the
+                # object was already in the cache.
+                # if (defined $self->{session}{cache}{SessionObject}{$name});
             $retval = 1;
         }
         elsif ($var =~ /^\{/) {  # { i.e. "{columnSelected}{first_name}"
     
             $var =~ s/\{([^\}]+)\}/\{"$1"\}/g;  # put quotes around hash keys
     
-            #$self->session_object($name) if (!defined $self->{session}{cache}{SessionObject}{$name});
-    
             $perl  = "\$self->{session}{store}{SessionObject}{\$name}$var = \$value;";
             $perl .= "\$self->{session}{cache}{SessionObject}{\$name}$var = \$value;"
                 if (defined $self->{session}{cache}{SessionObject}{$name});
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.