2.7. Session data structure

Each user session is a hash reference saved in some sort of data repository. By default it is file-based using the Storable manpage, but it can reside in any Interchange database type as well.

It is placed at the global variable location $Vend::Session, which for programming use in UserTag and GlobalSub routines is $Session (meaning $Vend::Interpolate::Session).

The structure is initialized when the session is created (or canceled by the user). The initial form is described in Vend::Session::init_session:

    $Vend::Session = {
                'ohost'         => $CGI::remote_addr,
                'arg'           => $Vend::Argument,
                'browser'       => $CGI::useragent,
                'referer'       => $CGI::referer,
                'scratch'       => { %{$Vend::Cfg->{ScratchDefault}} },
                'values'        => { %{$Vend::Cfg->{ValuesDefault}} },
                'carts'         => {main => []},
                'levies'        => {main => []},

This structure is used as a repository for the transitory user session values like form values, scratch variable settings, payment transaction results, errors, and any other user-tied values. It is also possible to add code that can be run on a user-by-user basis with the Autoload, Filter, and Profile facilities.