* [PATCH 2/3] config: allow taking an existing reference
2016-05-16 7:56 4% [PATCH 0/3] inbox objectification cleanups + fixes Eric Wong
@ 2016-05-16 7:56 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-05-16 7:56 UTC (permalink / raw)
To: meta
This should make creating test cases easier and faster.
---
lib/PublicInbox/Config.pm | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index 3f3707e..b5f0fcb 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -15,9 +15,12 @@ use File::Path::Expand qw/expand_filename/;
sub new {
my ($class, $file) = @_;
$file = default_file() unless defined($file);
- my $self = bless git_config_dump($file), $class;
- $self->{-by_addr} = {};
- $self->{-by_name} = {};
+ $file = ref $file ? $file : git_config_dump($file);
+ my $self = bless $file, $class;
+
+ # caches
+ $self->{-by_addr} ||= {};
+ $self->{-by_name} ||= {};
$self;
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/3] inbox objectification cleanups + fixes
@ 2016-05-16 7:56 4% Eric Wong
2016-05-16 7:56 7% ` [PATCH 2/3] config: allow taking an existing reference Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-05-16 7:56 UTC (permalink / raw)
To: meta
This series is mainly paving the way for future cleanups
and marking some old code paths as deprecated. There's
also a legitimate bugfix for redirecting under "mount"
directives in Plack::Builder.
Eric Wong (3):
declare Inbox object for reusability
config: allow taking an existing reference
www: fix for running under mount paths
lib/PublicInbox/Config.pm | 54 +++++++++++++++++++-------
lib/PublicInbox/Feed.pm | 36 +++++++++---------
lib/PublicInbox/Inbox.pm | 96 +++++++++++++++++++++++++++++++++++++++++++++++
lib/PublicInbox/WWW.pm | 57 ++++++++++++----------------
script/public-inbox-init | 4 +-
script/public-inbox-mda | 4 +-
t/config.t | 6 ++-
t/inbox.t | 12 ++++++
t/psgi_mount.t | 78 ++++++++++++++++++++++++++++++++++++++
9 files changed, 277 insertions(+), 70 deletions(-)
^ permalink raw reply [relevance 4%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-05-16 7:56 4% [PATCH 0/3] inbox objectification cleanups + fixes Eric Wong
2016-05-16 7:56 7% ` [PATCH 2/3] config: allow taking an existing reference Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).