sub bake { my $cookie = shift; my @args = @_; use CGI; my $query = new CGI; # Make a new cookie my $new_cookie = $query->cookie(@args); # Get the cookies already baked my $cookies = $cookie->param('cookies'); my @new_cookies; push(@new_cookies, $new_cookie); push(@new_cookies, @$cookies) if $cookies; $cookie->param('cookies', ¥@new_cookies); } #### sub return_cookies { my $cookie = shift ; my $cookies = $cookie->param('cookies'); $cookie->debug("SET @$cookies") if $cookies; return @$cookies if $cookies; } #### sub top { my $app = shift; # Reset the cookies $app->cookie->bake(-name=>'site', -value=>$app->query->param('site'), -expires=>'1h'); $app->cookie->bake(-name=>'keyword_or', -value=>'', -expires=>'-1h'); $app->param('template', $app->get_template('top.html')); return ($app->output); } sub results { my $app = shift; # Do stuff to the keyword &manage_keyword($app) if ($app->query->param('do_search')); return ($app->output); } sub manage_keyword { my $app = shift; my $keyword_or = $app->query->param('keyword_or'); $keyword_combined ||= $app->query->cookie('keyword_or'); .... $app->cookie->bake(-name=>'keyword_or', -value=>"$keyword_or") if $keyword_or; ..... } #### $app->cookie->bake(-name=>'keyword_or', -value=>'', -expires=>'-1h');