From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 6/6] URIimap: overload "" to ->as_string
Date: Fri, 19 Feb 2021 05:09:55 -0700 [thread overview]
Message-ID: <20210219120955.13891-7-e@80x24.org> (raw)
In-Reply-To: <20210219120955.13891-1-e@80x24.org>
This interpolation is used by the upstream URI package
and we rely on it elsewhere for HTTP(S) URIs, so save
ourselves some surprises down the line.
---
lib/PublicInbox/URIimap.pm | 1 +
t/uri_imap.t | 1 +
xt/net_writer-imap.t | 2 +-
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/URIimap.pm b/lib/PublicInbox/URIimap.pm
index ab0908b7..db84ee5e 100644
--- a/lib/PublicInbox/URIimap.pm
+++ b/lib/PublicInbox/URIimap.pm
@@ -13,6 +13,7 @@ package PublicInbox::URIimap;
use strict;
use URI::Split qw(uri_split uri_join); # part of URI
use URI::Escape qw(uri_unescape);
+use overload '""' => \&as_string;
my %default_ports = (imap => 143, imaps => 993);
diff --git a/t/uri_imap.t b/t/uri_imap.t
index 6c4207c3..f7c78665 100644
--- a/t/uri_imap.t
+++ b/t/uri_imap.t
@@ -19,6 +19,7 @@ is($uri->auth, undef);
is($uri->user, undef);
$uri = PublicInbox::URIimap->new('imaps://foo@0/');
+is("$uri", $uri->as_string, '"" overload works');
is($uri->host, '0', 'numeric host');
is($uri->user, 'foo', 'user extracted');
diff --git a/xt/net_writer-imap.t b/xt/net_writer-imap.t
index ea812f16..dfd765be 100644
--- a/xt/net_writer-imap.t
+++ b/xt/net_writer-imap.t
@@ -29,7 +29,7 @@ $nwr->{pi_cfg} = bless {}, 'PublicInbox::Config';
my $mics = $nwr->imap_common_init;
my $mic = (values %$mics)[0];
my $cleanup = PublicInbox::OnDestroy->new(sub {
- $mic->delete($folder) or fail "delete $folder <$$folder_uri>: $@";
+ $mic->delete($folder) or fail "delete $folder <$folder_uri>: $@";
});
my $imap_append = $nwr->can('imap_append');
my $smsg = bless { kw => [ 'seen' ] }, 'PublicInbox::Smsg';
prev parent reply other threads:[~2021-02-19 12:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-19 12:09 [PATCH 0/6] lei: start working on IMAP writes Eric Wong
2021-02-19 12:09 ` [PATCH 1/6] t/lei-externals: favor "-o format:$PATHNAME" over "-f" Eric Wong
2021-02-19 12:09 ` [PATCH 2/6] lei_to_mail: get rid of empty _post_augment_maildir Eric Wong
2021-02-19 12:09 ` [PATCH 3/6] tests: require Mail::IMAPClient for IMAP tests Eric Wong
2021-02-19 12:09 ` [PATCH 4/6] net_reader: handle single-message IMAP mailboxes Eric Wong
2021-02-19 12:09 ` [PATCH 5/6] net_writer: start implementing IMAP write support Eric Wong
2021-02-19 12:09 ` Eric Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210219120955.13891-7-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).