atistler has asked for the wisdom of the Perl Monks concerning the following question:

Very simple code example. As I understand it, Apache::Session::x will enable you to tie a hash to either a file, memory, or database. when you put something in that hash it should be represented in the datasource somehow. When I run the following code, Apache-Session-xxxxx.lock is created but it is empty. I don't understand why. When I try to a seperate piece of code to extract the info from that file (by tieing) another hash to that file, the hash is empty (except for the _session_id).
#!/usr/local/bin/perl use strict; use Apache::Session::File; use Data::Dumper; my $session_id = undef; my %session; my $opts = { Directory => '/tmp', LockDirectory => '/tmp', Transaction + => 0 }; tie %session, 'Apache::Session::File', $session_id, $opts; $session{name} = 'me'; $session{hello} = 'bye';

Replies are listed 'Best First'.
Re: apache session does not put anything in file
by Anonymous Monk on Jan 08, 2007 at 10:10 UTC
    Apache-Session-xxxxx.lock is supposed to be empty
Re: apache session does not put anything in file
by Anonymous Monk on Jan 08, 2007 at 10:14 UTC
    add
    warn "Undefined ", $session_id; $session_id = $session{_session_id}; warn "Defined ", $session_id;