]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: standardize interface a bit
authorEric Wong <e@80x24.org>
Mon, 7 Mar 2016 08:10:56 +0000 (08:10 +0000)
committerEric Wong <e@80x24.org>
Tue, 5 Apr 2016 18:58:27 +0000 (18:58 +0000)
Make it closer to what the existing WWW interface is since
we no longer rely on CGI.pm

examples/repobrowse.psgi
lib/PublicInbox/Repobrowse.pm

index a642911fe62f719a2715bc29b8fddc695dbad56c..6e7a591b9a34b3e6874452a1eac8b55017e794f6 100644 (file)
@@ -6,7 +6,6 @@
 use strict;
 use warnings;
 use PublicInbox::Repobrowse;
-use Plack::Request;
 use Plack::Builder;
 my $have_deflater = eval { require Plack::Middleware::Deflater; 1 };
 my $repo_browse = PublicInbox::Repobrowse->new;
@@ -19,8 +18,5 @@ builder {
                                          'application/atom+xml' ];
        }
        enable 'Head';
-       sub {
-               my $req = Plack::Request->new(@_);
-               $repo_browse->run($req, $req->method);
-       }
+       sub { $repo_browse->call(@_) }
 }
index 51ec14c8ec435a058b19f28b57251c8f19b7e310..fe06a5befb0552a883a1aaf3f7c9af517e4ce6f3 100644 (file)
@@ -20,6 +20,7 @@
 package PublicInbox::Repobrowse;
 use strict;
 use warnings;
+use Plack::Request;
 use URI::Escape qw(uri_escape_utf8 uri_unescape);
 use PublicInbox::RepobrowseConfig;
 
@@ -66,8 +67,10 @@ sub root_index {
        $mod->new->call($self->{rconfig}); # RepobrowseRoot::call
 }
 
-sub run {
-       my ($self, $cgi, $method) = @_;
+sub call {
+       my ($self, $env) = @_;
+       my $cgi = Plack::Request->new($env);
+       my $method = $cgi->method;
        return r(405, 'Method Not Allowed') if ($method !~ /\AGET|HEAD|POST\z/);
 
        # URL syntax: / repo [ / cmd [ / path ] ]