X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/8b237b43167a2443b69b6c0a3aec13c926782fc1..33e3013acbef27ba49fa091389ed8bf4096fa860:/common.inc.plp diff --git a/common.inc.plp b/common.inc.plp index 21cbc0d..c6b0c84 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -10,6 +10,11 @@ use File::stat 'stat'; use HTTP::Date; use Shiar_Sheet::KeySigns qw(%sign); +$PLP::ERROR = sub { + my ($text, $html) = @_; + print '

Fatal error: '.$html."

\n\n"; +}; + our $style; our $showkeys = !exists $get{keys} ? undef : ($get{keys} ne '0' && ($get{keys} || 'always')); @@ -22,12 +27,14 @@ 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];