From cab1ac75c91d8c351c41920a02e79484a34428e2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 26 Jul 2008 15:43:25 -0400 Subject: [PATCH] refactor --- IkiWiki/Setup.pm | 3 ++- IkiWiki/Setup/Standard.pm | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index adb8abb62..262d49479 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -66,9 +66,10 @@ sub dump ($) { #{{{ my $file=IkiWiki::possibly_foolish_untaint(shift); require IkiWiki::Setup::Standard; + my @dump=IkiWiki::Setup::Standard::gendump("Setup file for ikiwiki."); open (OUT, ">", $file) || die "$file: $!"; - print OUT "$_\n" foreach IkiWiki::Setup::Standard::gendump(); + print OUT "$_\n" foreach @dump; close OUT; } diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index 22bfc38a4..54819ae75 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -71,7 +71,8 @@ sub dumpvalues ($@) { #{{{ return @ret; } #}}} -sub gendump () { #{{{ +sub gendump ($) { #{{{ + my $description=shift; my %setup=(%config); my @ret; @@ -88,14 +89,15 @@ sub gendump () { #{{{ push @ret, ""; } - unshift @ret, "#!/usr/bin/perl -# Setup file for ikiwiki. -# Passing this to ikiwiki --setup will make ikiwiki generate wrappers and -# build the wiki. -# -# Remember to re-run ikiwiki --setup any time you edit this file. - -use IkiWiki::Setup::Standard {"; + unshift @ret, + "#!/usr/bin/perl", + "# $description", + "#", + "# Passing this to ikiwiki --setup will make ikiwiki generate", + "# wrappers and build the wiki.", + "#", + "# Remember to re-run ikiwiki --setup any time you edit this file.", + "use IkiWiki::Setup::Standard {"; push @ret, "}"; return @ret; -- 2.26.2