X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FConfigIter.pm;h=e6fa81728a1afda8293b58fc92b33fa199aa2150;hb=f303b4add8ea18835f7f304910ba8fac3ee4f912;hp=26cc70e28ce5094254a0df4c1e518fe603cb1c04;hpb=8fdea96141a65ac85d22d21ed9e3f999259ee73c;p=public-inbox.git diff --git a/lib/PublicInbox/ConfigIter.pm b/lib/PublicInbox/ConfigIter.pm index 26cc70e2..e6fa8172 100644 --- a/lib/PublicInbox/ConfigIter.pm +++ b/lib/PublicInbox/ConfigIter.pm @@ -25,4 +25,16 @@ sub event_step { PublicInbox::DS::requeue($self) if defined($section); } +# for generic PSGI servers +sub each_section { + my $self = shift; + my ($pi_cfg, $i, $cb, @arg) = @$self; + while (defined(my $section = $pi_cfg->{-section_order}->[$$i++])) { + eval { $cb->($pi_cfg, $section, @arg) }; + warn "E: $@ in ${self}::each_section" if $@; + } + eval { $cb->($pi_cfg, undef, @arg) }; + warn "E: $@ in ${self}::each_section" if $@; +} + 1;