[ic] Patch to Session.pm to Allow SessionDefault ala ScratchDefault
and ValuesDefault
shawn at stuckinrealtime.us
shawn at stuckinrealtime.us
Sun Oct 19 03:53:57 EDT 2003
Hi All,
I needed to set a default value for the session source and found that
there was no way to do this, so I added a Directive in Interchange.cfg
and changed Session.pm.
I made it so it skips things that interchange has already defined and
only addes new entries.
I would appreciate any/all questions and comments, and maybe some idea
of why this isn't a standard interchange feature. i.e. Is this a bad
idea? Is there another way to do this, that I was too blind to see in
the docs?
-- BEGIN CHANGES --
interchange.cfg
AddDirective SessionDefault hash
Session.pm [In Diff Context format, I think this is the way to post
changes like this]
*** Session-Orig.pm Sat Oct 18 23:23:03 2003
--- Session.pm Sat Oct 18 23:36:22 2003
***************
*** 456,463 ****
--- 456,470 ----
'carts' => {main => []},
'levies' => {main => []},
};
+
$Vend::Session->{shost} = $CGI::remote_addr
if $CGI::secure;
+
+ foreach my $default (keys %{$Vend::Cfg->{SessionDefault}}) {
+ next if defined $Vend::Session->{$default}; # Don't replace
Things already defined in Vend::Session
+ $Vend::Session->{$default} =
$Vend::Cfg->{SessionDefault}->{$default};
+ }
+
$::Values = $Vend::Session->{values};
$::Scratch = $Vend::Session->{scratch};
$::Scratch->{mv_locale} ||= $Vend::Cfg->{DefaultLocale};
--- END CHANGES ---
Thanks,
Shawn Mathews
shawn at stuckinrealtime.us
More information about the interchange-users
mailing list