summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a2e1397)
Creating a CGI::Cookie object will fail if given an undefined value, causing
a fatal error trying to stringify and add it:
> Can't call method "as_string" on an undefined value
if (exists $get{style}) {
$style = $styles{ $get{style} };
require CGI::Cookie;
if (exists $get{style}) {
$style = $styles{ $get{style} };
require CGI::Cookie;
- AddCookie(CGI::Cookie->new(
+ if (my $cookie = CGI::Cookie->new(
-name => 'style',
-value => $style,
-path => '/', # site-wide; current page is confusing to most users
-expires => $style ? '+5y' : '-1d',
-name => 'style',
-value => $style,
-path => '/', # site-wide; current page is confusing to most users
-expires => $style ? '+5y' : '-1d',
+ )) {
+ AddCookie($cookie->as_string);
+ }
}
$style ||= exists $cookie{style} && $styles{ $cookie{style} } || $_[0];
}
$style ||= exists $cookie{style} && $styles{ $cookie{style} } || $_[0];