about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepoBrowseBase.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/RepoBrowseBase.pm')
-rw-r--r--lib/PublicInbox/RepoBrowseBase.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/PublicInbox/RepoBrowseBase.pm b/lib/PublicInbox/RepoBrowseBase.pm
new file mode 100644
index 00000000..cd9e66de
--- /dev/null
+++ b/lib/PublicInbox/RepoBrowseBase.pm
@@ -0,0 +1,22 @@
+# Copyright (C) 2015 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+package PublicInbox::RepoBrowseBase;
+use strict;
+use warnings;
+require PublicInbox::RepoBrowseQuery;
+require PublicInbox::Hval;
+
+sub new { bless {}, shift }
+
+sub call {
+        my ($self, $req) = @_;
+        my $vcs = $req->{repo_info}->{vcs};
+        my $rv = eval {
+                no strict 'refs';
+                my $sub = 'call_'.$vcs;
+                $self->$sub($req);
+        };
+        $@ ? [ 500, ['Content-Type'=>'text/plain'], [] ] : $rv;
+}
+
+1;