From: Joey Hess Date: Thu, 10 Jul 2008 17:16:03 +0000 (-0400) Subject: work around CGI::Session constructor issues X-Git-Tag: 2.54~162 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5d26ded3811cd050a1c70ccf76f3022a787a9588;p=ikiwiki.git work around CGI::Session constructor issues The constructor can fail with a useless error message if module fail to load. Work around this by evaling it, and checking for failures, and printing CGI::Session->errstr to get a more useful message. --- diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 99cead64f..52d3474f5 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -645,8 +645,14 @@ sub cgi_getsession ($) { #{{{ CGI::Session->name("ikiwiki_session_".encode_utf8($config{wikiname})); my $oldmask=umask(077); - my $session = CGI::Session->new("driver:DB_File", $q, - { FileName => "$config{wikistatedir}/sessions.db" }); + my $session = eval { + CGI::Session->new("driver:DB_File", $q, + { FileName => "$config{wikistatedir}/sessions.db" }) + }; + if (! $session || $@) { + error($@." ".CGI::Session->errstr()); + } + umask($oldmask); return $session;