diff options
author | Eric Wong <e@80x24.org> | 2019-12-25 07:50:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-12-27 20:00:37 +0000 |
commit | 4bffd23fdd592c356c9b3d56b202d178a12fec43 (patch) | |
tree | ec64798ce143b45a300bd23de3a4c6226ec4acaf /lib/PublicInbox/Config.pm | |
parent | 8b192073ae9e940ec066811aaa5618a1601f0565 (diff) | |
download | public-inbox-4bffd23fdd592c356c9b3d56b202d178a12fec43.tar.gz |
Another place where we can replace anonymous subs with named subs by passing a user-supplied arg.
Diffstat (limited to 'lib/PublicInbox/Config.pm')
-rw-r--r-- | lib/PublicInbox/Config.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index bdde3dbc..8ecf549d 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -63,12 +63,13 @@ sub new { $self; } -sub _fill_all ($) { each_inbox($_[0], sub {}) } +sub noop {} +sub fill_all ($) { each_inbox($_[0], \&noop) } sub _lookup_fill ($$$) { my ($self, $cache, $key) = @_; $self->{$cache}->{$key} // do { - _fill_all($self); + fill_all($self); $self->{$cache}->{$key}; } } @@ -89,12 +90,12 @@ sub lookup_name ($$) { } sub each_inbox { - my ($self, $cb) = @_; + my ($self, $cb, $arg) = @_; # may auto-vivify if config file is non-existent: foreach my $section (@{$self->{-section_order}}) { next if $section !~ m!\Apublicinbox\.([^/]+)\z!; my $ibx = lookup_name($self, $1) or next; - $cb->($ibx); + $cb->($ibx, $arg); } } @@ -417,7 +418,7 @@ sub _fill { if ($ibx->{obfuscate}) { $ibx->{-no_obfuscate} = $self->{-no_obfuscate}; $ibx->{-no_obfuscate_re} = $self->{-no_obfuscate_re}; - _fill_all($self); # noop to populate -no_obfuscate + fill_all($self); # noop to populate -no_obfuscate } if (my $ibx_code_repos = $ibx->{coderepo}) { |