Quite right Tom...

I think I found the problem anyway, it appears to work fine now - see below, I've collapsed a few function calls to make it clearer but you'll see what silliness was going on...

I'm using method handlers and the object is preserved between requests, like so:

package DataSite;
$__PACKAGE__::persistent=__PACKAGE__->new();

httpd.conf:
   PerlFixupHandler $DataSite::persistent->fixup

Then I allow each phase to collect the cookies like this... spot the preserved reference...

sub fixup : method {
my ($self,$r)[EMAIL PROTECTED];
my $cookies=$self->get_cookies($r);
if($$cookies{shopping_cart}){
$self->{shopping_cart}=$$cookies{'shopping_cart'}; # oh boy now I feel stupid...
}
}

And just for the record, get_cookies (written this way so every phase can call this but the cookies are only fetched once):

sub get_cookies {
 my ($self,$r)[EMAIL PROTECTED];
 my $cookies=$r->pnotes('cookies') and return $cookies;
 $cookies=Apache2::Cookie::Validated->fetch($r,$my_secret_key);
 $r->pnotes('cookies',$cookies);
 return $cookies;
}

(Apache2::Cookie::Validated is a subclass I made which validates cookie content to prevent tampering, useful for authentication and online ordering cookies - hoping to get time to CPANify it one day)

cheers
John


Tom Schindl wrote:

A little but more code would be help to see what you are really doing ;-)

Tom

Reply via email to