didn't work
Details? The relevant part of your code, messages found in the error log?
Documentation of CGI::Session says it is compatible with any CGI.pm like modules which have param() method.
But CGI::Lite::Request do have param() method.
Did you notice that load() in CGI::Session calls the cookie() method of $request (called $query in the CGI::Session source)? According to the documentation, cookie('somename') in CGI returns the cookie value (a string, a hash, or an array), but cookie('somename') in CGI::Lite::Request returns an instance of CGI::Lite::Cookie (an object).
The current version of CGI::Session on CPAN also documents that the cookie() method is called, but it does not document what it is expected to return. The code seems to expect it to behave like CGI's cookie() method, i.e. return the value of the cookie, not a cookie object.
Your options:
- Extract the session ID from $request in your code, then pass the session ID, not $request, as second parameter to load().
- Patch CGI::Session to call the value() method on the return value of cookie()
- Create a helper object that implements param() and cookie() as expected by CGI::Session based on data from $request. Pass that object instead of $request to load(). (See below)
The helper class, quick and dirty and not tested:
sub new
{
my ($class,$lite_request)=@_;
return bless [ $lite_request ],$class;
}
sub param
{
my ($self,$name)=@_;
return $self->[0]->param($name);
}
sub cookie
{
my ($self,$name)=@_;
return $self->[0]->cookie($name)->value();
}
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
|