* [PATCH 1/4] inboxwritable: mime_from_path: reduce `$/' scope and returns
2020-08-01 8:12 6% [PATCH 0/4] cleanup some minor annoyances Eric Wong
@ 2020-08-01 8:12 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-08-01 8:12 UTC (permalink / raw)
To: meta
We don't want `local $/' affecting Eml->new, and we can
use implicit returns which may be faster on older Perl.
---
lib/PublicInbox/InboxWritable.pm | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm
index 1f3f66728..e8ecd3fba 100644
--- a/lib/PublicInbox/InboxWritable.pm
+++ b/lib/PublicInbox/InboxWritable.pm
@@ -8,6 +8,7 @@ use warnings;
use base qw(PublicInbox::Inbox);
use PublicInbox::Import;
use PublicInbox::Filter::Base qw(REJECT);
+use Errno qw(ENOENT);
use constant {
PERM_UMASK => 0,
@@ -135,16 +136,11 @@ sub is_maildir_path ($) {
sub mime_from_path ($) {
my ($path) = @_;
if (open my $fh, '<', $path) {
- local $/;
- my $str = <$fh>;
- $str or return;
- return PublicInbox::Eml->new(\$str);
- } elsif ($!{ENOENT}) {
- # common with Maildir
- return;
- } else {
- warn "failed to open $path: $!\n";
- return;
+ my $str = do { local $/; <$fh> } or return;
+ PublicInbox::Eml->new(\$str);
+ } else { # ENOENT is common with Maildir
+ warn "failed to open $path: $!\n" if $! != ENOENT;
+ undef;
}
}
^ permalink raw reply related [relevance 7%]
* [PATCH 0/4] cleanup some minor annoyances
@ 2020-08-01 8:12 6% Eric Wong
2020-08-01 8:12 7% ` [PATCH 1/4] inboxwritable: mime_from_path: reduce `$/' scope and returns Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-08-01 8:12 UTC (permalink / raw)
To: meta
Just some minor stuff I noticed while tracking down -watch
failures resolved by
https://public-inbox.org/meta/20200731213618.GA19572@dcvr/
Eric Wong (4):
inboxwritable: mime_from_path: reduce `$/' scope and returns
inboxwritable: rename mime_from_path to eml_from_path
searchidx: remove v1-only msg_mime sub
remove unnecessary ->header_obj calls
lib/PublicInbox/ContentHash.pm | 15 +++++++-------
lib/PublicInbox/Import.pm | 17 +++++++---------
lib/PublicInbox/InboxWritable.pm | 25 ++++++++++-------------
lib/PublicInbox/MID.pm | 5 +----
lib/PublicInbox/OverIdx.pm | 9 ++++----
lib/PublicInbox/SearchIdx.pm | 30 ++++++++++++---------------
lib/PublicInbox/V2Writable.pm | 35 +++++++++++++++-----------------
lib/PublicInbox/View.pm | 35 +++++++++++++++-----------------
lib/PublicInbox/WatchMaildir.pm | 10 ++++-----
lib/PublicInbox/WwwAtomStream.pm | 9 ++++----
script/public-inbox-edit | 15 +++++++-------
script/public-inbox-mda | 2 +-
t/search.t | 1 +
13 files changed, 92 insertions(+), 116 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 --
2020-08-01 8:12 6% [PATCH 0/4] cleanup some minor annoyances Eric Wong
2020-08-01 8:12 7% ` [PATCH 1/4] inboxwritable: mime_from_path: reduce `$/' scope and returns 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).