X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/881b4a69e47004c59f35979620b65fd3d4aaaf16..e8e8d5a7167d69ba8ccc16dab1ab39c40899a5b8:/common.inc.plp diff --git a/common.inc.plp b/common.inc.plp index 4bf28bf..963b8a6 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -22,19 +22,21 @@ sub stylesheet { 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', - )->as_string); + )) { + AddCookie($cookie->as_string); + } } $style ||= exists $cookie{style} && $styles{ $cookie{style} } || $_[0]; return join "\n", map { sprintf( '', - $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.5", $_ + $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css?1.6", $_ ) } @_; } @@ -77,7 +79,7 @@ sub Html { !$showkeys ? '' : $showkeys eq 'ghost' ? '' : (), - '', + '', ) if $meta->{keys}; # flatten arrays