From b073359b18be7940d5138037a6423b8c45bfa39f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 26 Jul 2008 15:39:41 -0400 Subject: [PATCH] refactor --- IkiWiki/Setup.pm | 10 ++++++++++ IkiWiki/Setup/Standard.pm | 8 ++------ ikiwiki.in | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 9c45a8baf..adb8abb62 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -62,4 +62,14 @@ sub load ($) { # {{{ } } #}}} +sub dump ($) { #{{{ + my $file=IkiWiki::possibly_foolish_untaint(shift); + + require IkiWiki::Setup::Standard; + + open (OUT, ">", $file) || die "$file: $!"; + print OUT "$_\n" foreach IkiWiki::Setup::Standard::gendump(); + close OUT; +} + 1 diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index ed4331d61..22bfc38a4 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -71,9 +71,7 @@ sub dumpvalues ($@) { #{{{ return @ret; } #}}} -sub dump ($) { #{{{ - my $file=IkiWiki::possibly_foolish_untaint(shift); - +sub gendump () { #{{{ my %setup=(%config); my @ret; @@ -100,9 +98,7 @@ sub dump ($) { #{{{ use IkiWiki::Setup::Standard {"; push @ret, "}"; - open (OUT, ">", $file) || die "$file: $!"; - print OUT "$_\n" foreach @ret; - close OUT; + return @ret; } #}}} 1 diff --git a/ikiwiki.in b/ikiwiki.in index 8cb8a4769..febc8ff56 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -150,8 +150,8 @@ sub main () { #{{{ } if ($config{dumpsetup}) { - require IkiWiki::Setup::Standard; - IkiWiki::Setup::Standard::dump($config{dumpsetup}); + require IkiWiki::Setup; + IkiWiki::Setup::dump($config{dumpsetup}); } elsif ($config{wrapper}) { lockwiki(); -- 2.39.5