From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1DCF71FB0F for ; Fri, 19 Feb 2021 12:09:58 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/6] URIimap: overload "" to ->as_string Date: Fri, 19 Feb 2021 05:09:55 -0700 Message-Id: <20210219120955.13891-7-e@80x24.org> In-Reply-To: <20210219120955.13891-1-e@80x24.org> References: <20210219120955.13891-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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';