unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/4] www: comments for denoting Plack::Request vs CGI
Date: Mon,  4 Jan 2016 01:03:50 +0000	[thread overview]
Message-ID: <20160104010352.26568-3-e@80x24.org> (raw)
In-Reply-To: <20160104010352.26568-1-e@80x24.org>

We'll probably want to continue supporting CGI for mod_perl
compatibility.
---
 lib/PublicInbox/ExtMsg.pm | 2 +-
 lib/PublicInbox/Feed.pm   | 2 +-
 lib/PublicInbox/WWW.pm    | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index 59bbae5..a56df33 100644
--- a/lib/PublicInbox/ExtMsg.pm
+++ b/lib/PublicInbox/ExtMsg.pm
@@ -89,7 +89,7 @@ sub ext_msg {
 again:
 		my $cgi = $ctx->{cgi};
 		my $url = ref($cgi) eq 'CGI' ? $cgi->url(-base) . '/'
-					: $cgi->base->as_string;
+				: $cgi->base->as_string; # Plack::Request
 		$url .= $listname;
 		unshift @pfx, { git_dir => $ctx->{git_dir}, url => $url };
 		foreach my $pfx (@pfx) {
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 5708b60..65514eb 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -287,7 +287,7 @@ sub get_feedopts {
 		my $base;
 		if (ref($cgi) eq 'CGI') {
 			$base = $cgi->url(-base);
-		} else {
+		} else { # Plack::Request
 			$base = $cgi->base->as_string;
 			$base =~ s!/\z!!;
 		}
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index b4c050b..411db16 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -198,6 +198,7 @@ sub get_thread {
 
 sub self_url {
 	my ($cgi) = @_;
+						# Plack::Request
 	ref($cgi) eq 'CGI' ? $cgi->self_url : $cgi->uri->as_string;
 }
 
@@ -362,7 +363,7 @@ sub r301 {
 	if (ref($cgi) eq 'CGI') {
 		$url = $cgi->url(-base) . '/';
 		$qs = $cgi->query_string;
-	} else {
+	} else { # Plack::Request
 		$url = $cgi->base->as_string;
 		$qs = $cgi->env->{QUERY_STRING};
 	}
-- 
EW


  parent reply	other threads:[~2016-01-04  1:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04  1:03 [PATCH 0/4] misc updates to push Eric Wong
2016-01-04  1:03 ` [PATCH 1/4] examples/public-inbox.psgi: shorten to simplify Eric Wong
2016-01-04  1:03 ` Eric Wong [this message]
2016-01-04  1:03 ` [PATCH 3/4] misc doc updates Eric Wong
2016-01-04  1:03 ` [PATCH 4/4] view: label "relevance" in threaded search view Eric Wong

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=20160104010352.26568-3-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.
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).