I found a pretty useful article at http://www.linuxjournal.com/article.php?sid=4143 on how to use Apache::Session with Mason. I followed the article, more or less, and ended up with this bit of code in my handler.pl to tie() my $session variable to an Apache::Session class:

eval {
tie %HTML::Mason::Commands::session, 'Apache::Session::DBI',
($cookies{$session_cookie_name} ? $cookies{$session_cookie_name}->value() : undef),
{
DataSource => $dbsource,
UserName => $dbuser,
Password => $dbpass
};
};


All the database variables are correct; I use them elsewhere with no problem. The problem is that the session seems to be intermittent-- some pages seem to recognize it, others don't. This smelled a lot like a problem where the session was getting set in one Apache instance and not others, so I wondered if the session was getting stored in the database correctly; after the previous eval, all I ever get in $@ is:

Permission denied at /Library/Perl/Apache/Session/SysVSemaphoreLocker.pm line 46.

Which seems to indicate it isn't. I STFW, and found several people who seem to have had the same problem I have, but the solutions proffered involve ipcs and ipcrm, which don't exist on my Mac OS X 10.2.6 system. Suggestions are more than welcome; I'm not quite sure how Session::SysVSempaphoreLocker got involved in the first place, since I don't explicitly reference it.

Mightily confused,

-=Eric

Reply via email to