]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Setup/Standard.pm
Silence "used only once: possible typo" warnings for variables that are part of modul...
[git.ikiwiki.info.git] / IkiWiki / Setup / Standard.pm
index 92e97c4b41fcbaed41b1a4ca2e787da7913f0526..07a66f3db279eabf6907c842e986b4c35095d3d5 100644 (file)
@@ -1,6 +1,4 @@
 #!/usr/bin/perl
-# Standard ikiwiki setup module.
-# Parameters to import should be all the standard ikiwiki config stuff.
 
 package IkiWiki::Setup::Standard;
 
@@ -8,6 +6,7 @@ use warnings;
 use strict;
 use IkiWiki;
 
+# Parameters to import should be all the standard ikiwiki config, in a hash.
 sub import {
        IkiWiki::Setup::merge($_[1]);
 }
@@ -15,11 +14,14 @@ sub import {
 sub gendump ($@) {
        my $class=shift;
 
-       "#!/usr/bin/perl",
+       my $thisperl = eval q{use Config; $Config{perlpath}};
+       error($@) if $@;
+
+       "#!$thisperl",
        "#",
        (map { "# $_" } @_),
        "use IkiWiki::Setup::Standard {",
-       IkiWiki::Setup::commented_dump(\&dumpline),
+       IkiWiki::Setup::commented_dump(\&dumpline, "\t"),
        "}"
 }
 
@@ -31,6 +33,7 @@ sub dumpline ($$$$) {
        
        eval q{use Data::Dumper};
        error($@) if $@;
+       no warnings 'once';
        local $Data::Dumper::Terse=1;
        local $Data::Dumper::Indent=1;
        local $Data::Dumper::Pad="\t";
@@ -38,6 +41,7 @@ sub dumpline ($$$$) {
        local $Data::Dumper::Quotekeys=0;
        # only the perl version preserves utf-8 in output
        local $Data::Dumper::Useperl=1;
+       use warnings;
        
        my $dumpedvalue;
        if (($type eq 'boolean' || $type eq 'integer') && $value=~/^[0-9]+$/) {