user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 4/5] filter/base: export REJECT as a constant
  2019-12-31 10:30  6% [PATCH 0/5] some minor cleanups and doc updates Eric Wong
@ 2019-12-31 10:30  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-12-31 10:30 UTC (permalink / raw)
  To: meta

And update callers to use it, as it makes the code a bit cleaner.
Probably irrelvant, but it should be faster, too, as
"perl -I lib -w -MO=Deparse $FILE" shows REJECT() calls are
constant-folded.
---
 lib/PublicInbox/Filter/Base.pm   | 2 ++
 lib/PublicInbox/InboxWritable.pm | 3 +--
 lib/PublicInbox/WatchMaildir.pm  | 3 +--
 script/public-inbox-purge        | 4 +---
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/PublicInbox/Filter/Base.pm b/lib/PublicInbox/Filter/Base.pm
index 7a0c720f..81adab2a 100644
--- a/lib/PublicInbox/Filter/Base.pm
+++ b/lib/PublicInbox/Filter/Base.pm
@@ -6,6 +6,8 @@ package PublicInbox::Filter::Base;
 use strict;
 use warnings;
 use PublicInbox::MsgIter;
+use parent qw(Exporter);
+our @EXPORT_OK = qw(REJECT); # we may export IGNORE if/when needed
 
 sub No ($) { "*** We only accept plain-text mail, No $_[0] ***" }
 
diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm
index d8391251..228e786c 100644
--- a/lib/PublicInbox/InboxWritable.pm
+++ b/lib/PublicInbox/InboxWritable.pm
@@ -7,8 +7,7 @@ use strict;
 use warnings;
 use base qw(PublicInbox::Inbox);
 use PublicInbox::Import;
-use PublicInbox::Filter::Base;
-*REJECT = *PublicInbox::Filter::Base::REJECT;
+use PublicInbox::Filter::Base qw(REJECT);
 
 use constant {
 	PERM_UMASK => 0,
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 003baec9..7803b58a 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -10,9 +10,8 @@ use PublicInbox::MIME;
 use PublicInbox::Spawn qw(spawn);
 use PublicInbox::InboxWritable;
 use File::Temp 0.19 ();
-use PublicInbox::Filter::Base;
+use PublicInbox::Filter::Base qw(REJECT);
 use PublicInbox::Spamcheck;
-*REJECT = *PublicInbox::Filter::Base::REJECT;
 *maildir_path_load = *PublicInbox::InboxWritable::maildir_path_load;
 
 sub new {
diff --git a/script/public-inbox-purge b/script/public-inbox-purge
index f103ccf7..22b56a8e 100755
--- a/script/public-inbox-purge
+++ b/script/public-inbox-purge
@@ -9,12 +9,10 @@ use warnings;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
 use PublicInbox::AdminEdit;
 PublicInbox::Admin::check_require('-index');
-use PublicInbox::Filter::Base;
+use PublicInbox::Filter::Base qw(REJECT);
 use PublicInbox::MIME;
 require PublicInbox::V2Writable;
 
-*REJECT = \&PublicInbox::Filter::Base::REJECT;
-
 my $usage = "$0 [--all] [INBOX_DIRS] </path/to/message";
 my $opt = { verbose => 1, all => 0, -min_inbox_version => 2 };
 GetOptions($opt, @PublicInbox::AdminEdit::OPT) or

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] some minor cleanups and doc updates
@ 2019-12-31 10:30  6% Eric Wong
  2019-12-31 10:30  7% ` [PATCH 4/5] filter/base: export REJECT as a constant Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-12-31 10:30 UTC (permalink / raw)
  To: meta

Actual features coming, later, but some cleanups and internal
doc updates I found along the way.  I'm a tiny bit worried
about PATCH 3/5 breaking somebody's setup because of old
versions of examples/public-inbox.psgi, but considering how
little adoption this project had in 2016, maybe it's not a
big deal...

Eric Wong (5):
  wwwstatic: getline: die on missing psgix.io
  http: update comment about psgix.io usage
  githttpbackend: remove ancient compatibility check
  filter/base: export REJECT as a constant
  cgit: type declaration for PublicInbox::Git

 lib/PublicInbox/Cgit.pm           |  3 ++-
 lib/PublicInbox/Filter/Base.pm    |  2 ++
 lib/PublicInbox/GitHTTPBackend.pm |  3 ---
 lib/PublicInbox/HTTP.pm           |  2 +-
 lib/PublicInbox/InboxWritable.pm  |  3 +--
 lib/PublicInbox/WatchMaildir.pm   |  3 +--
 lib/PublicInbox/WwwStatic.pm      | 20 +++++++++-----------
 script/public-inbox-purge         |  4 +---
 8 files changed, 17 insertions(+), 23 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-12-31 10:30  6% [PATCH 0/5] some minor cleanups and doc updates Eric Wong
2019-12-31 10:30  7% ` [PATCH 4/5] filter/base: export REJECT as a constant 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).