]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
* Apply patch from Ethan to improve an error message that should never
[ikiwiki.git] / IkiWiki.pm
index a6bfddab06f8b406fcb4bde84f745d5bc667c357..1c310d39157d1a5fd29e37b7b1fabaec87b72391 100644 (file)
@@ -6,6 +6,7 @@ use strict;
 use Encode;
 use HTML::Entities;
 use URI::Escape q{uri_escape_utf8};
+use POSIX;
 use open qw{:utf8 :std};
 
 use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
@@ -18,7 +19,9 @@ our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
                  displaytime will_render gettext urlto targetpage
                  %config %links %renderedfiles %pagesources);
 our $VERSION = 1.02; # plugin interface version, next is ikiwiki version
-our $version="1.45";my $installdir="/usr";
+our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
+my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE
+
 # Optimisation.
 use Memoize;
 memoize("abs2rel");
@@ -83,8 +86,6 @@ sub checkconfig () { #{{{
                delete $ENV{LC_ALL};
        }
        if (defined $config{locale}) {
-               eval q{use POSIX};
-               error($@) if $@;
                if (POSIX::setlocale(&POSIX::LC_ALL, $config{locale})) {
                        $ENV{LANG}=$config{locale};
                        $gettext_obj=undef;
@@ -247,7 +248,7 @@ sub srcfile ($) { #{{{
 
        return "$config{srcdir}/$file" if -e "$config{srcdir}/$file";
        return "$config{underlaydir}/$file" if -e "$config{underlaydir}/$file";
-       error("internal error: $file cannot be found");
+       error("internal error: $file cannot be found in $config{srcdir} or $config{underlaydir}");
 } #}}}
 
 sub readfile ($;$$) { #{{{
@@ -434,8 +435,6 @@ sub abs2rel ($$) { #{{{
 sub displaytime ($) { #{{{
        my $time=shift;
 
-       eval q{use POSIX};
-       error($@) if $@;
        # strftime doesn't know about encodings, so make sure
        # its output is properly treated as utf8
        return decode_utf8(POSIX::strftime(