web commit by JoshTriplett: Optional parameters for shortcuts.
[ikiwiki] / IkiWiki / Setup.pm
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5 use IkiWiki;
6 use open qw{:utf8 :std};
7
8 package IkiWiki;
9
10 sub setup () { # {{{
11         my $setup=possibly_foolish_untaint($config{setup});
12         delete $config{setup};
13         #translators: The first parameter is a filename, and the second
14         #translators: is a (probably not translated) error message.
15         open (IN, $setup) || error(sprintf(gettext("cannot read %s: %s"), $setup, $!));
16         my $code;
17         {
18                 local $/=undef;
19                 $code=<IN>;
20         }
21         ($code)=$code=~/(.*)/s;
22         close IN;
23
24         eval $code;
25         error($@) if $@;
26
27         exit;
28 } #}}}
29
30 1