
yapp
User
Mar 3, 2002, 12:57 PM
Views: 3079
|
...This should actually be posted in the beginner/immediate forum... I throught this does the trick: [perl] use CGI qw(:cgi); my $times = cookie('Cookie_Name') || 0; if($times > 5) { print redirect('some_url'); # Your redirect needs to be printed to the browser. exit; } else { set_cookie(); } sub set_cookie { my $cookieObj = cookie(-name => 'Cookie_Name', -value=> $times); print header( -cookie => $cookieObj ); # Send cookie with HTTP header } [/perl] btw, use CGI qw(:cgi); would be enough for CGI programs. (unless you want to generate HTML through the CGI.pm Yet Another Perl Programmer _________________________________ ~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~ More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads!
(This post was edited by yapp on Mar 3, 2002, 12:59 PM)
|