]> 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 9c177e497ae105a4e8646c40425cfc46f8a25644..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,24 +6,23 @@ 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]);
 }
 
-sub gendump ($$) {
+sub gendump ($@) {
        my $class=shift;
-       my $description=shift;
 
-       "#!/usr/bin/perl",
-       "# $description",
-       "#",
-       "# Passing this to ikiwiki --setup will make ikiwiki generate",
-       "# wrappers and build the wiki.",
+       my $thisperl = eval q{use Config; $Config{perlpath}};
+       error($@) if $@;
+
+       "#!$thisperl",
        "#",
-       "# Remember to re-run ikiwiki --setup any time you edit this file.",
+       (map { "# $_" } @_),
        "use IkiWiki::Setup::Standard {",
-       IkiWiki::Setup::commented_dump(\&dumpline),
-       "}";
+       IkiWiki::Setup::commented_dump(\&dumpline, "\t"),
+       "}"
 }
 
 sub dumpline ($$$$) {
@@ -36,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";
@@ -43,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]+$/) {