]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Setup.pm
attachment: Support old versions of CGI.pm that lack an upload method.
[git.ikiwiki.info.git] / IkiWiki / Setup.pm
index 63659ce2e03e7147be14063bf13e24278ddab94f..235e93eafa061219e96736787273106ee6a32225 100644 (file)
@@ -2,20 +2,28 @@
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
+use IkiWiki;
+use open qw{:utf8 :std};
 
 package IkiWiki;
 
 sub setup () { # {{{
        my $setup=possibly_foolish_untaint($config{setup});
        delete $config{setup};
 
 package IkiWiki;
 
 sub setup () { # {{{
        my $setup=possibly_foolish_untaint($config{setup});
        delete $config{setup};
-       open (IN, $setup) || error("read $setup: $!\n");
-       local $/=undef;
-       my $code=<IN>;
+       #translators: The first parameter is a filename, and the second
+       #translators: is a (probably not translated) error message.
+       open (IN, $setup) || error(sprintf(gettext("cannot read %s: %s"), $setup, $!));
+       my $code;
+       {
+               local $/=undef;
+               $code=<IN>;
+       }
        ($code)=$code=~/(.*)/s;
        close IN;
 
        eval $code;
        ($code)=$code=~/(.*)/s;
        close IN;
 
        eval $code;
-       error($@) if $@;
+       error("$setup: ".$@) if $@;
+
        exit;
 } #}}}
 
        exit;
 } #}}}