Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Cookie ..

Status
Not open for further replies.

davef101

MIS
Mar 3, 2006
34
GB
Whats wrong with this, it causes a 'Internal Server Error' ..

use CGI qw:)all);
use CGI::Cookie;

my $cookie = $q->cookie (
-name => 'COOKIENAME',
-value => '',
-path => '/',
-expires => '-1d'
);

print $q->header(-cookie => $cookie);

<html>
....
</html>
 
Maybe it's because your HTML code is just out there in the open?

Try this:

Code:
use CGI qw(:all);
use CGI::Cookie;

my $cookie = $q->cookie (
                -name    => 'COOKIENAME',
                -value   => '',
                -path    => '/',
                -expires => '-1d'
 );

print $q->header(-cookie => $cookie);

print qq~<html>
....
</html>~;

(just make sure your html code doesn't have a ~ symbol in it and it will work just fine. If it does have a ~, escape it with \~)
 
check the server error log, probably has something like:

Can't call method "cookie" on an undefined value at yourscript.pl line xx.

Code:
use CGI;
[b]my $q = CGI->new;[/b]

my $cookie = $q->cookie (
                -name    => 'COOKIENAME',
                -value   => '',
                -path    => '/',
                -expires => '-1d'
 );

print $q->header(-cookie => $cookie);

print qq~<html>
....
</html>~;
 
Here's a thing

internal server error

and there's no real FAQ on how to resolve it, we just keep answering the same thing over and over ...

anyone up for it? ;-)

point:
If you write an FAQ, link to a thread, that others may contribute, ... wish I did that :p

just a thought ...

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top