summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-10 13:16:03 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-10 13:17:56 -0400
commit5d26ded3811cd050a1c70ccf76f3022a787a9588 (patch)
tree9ae87ef4259f217689de22b150a9ad6c9252193c
parentf00e5a8a89d47c6dee8a63b1ab9c6d89de9a61cd (diff)
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.
-rw-r--r--IkiWiki/CGI.pm10
1 files changed, 8 insertions, 2 deletions
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;