From: Eric Wong Date: Thu, 27 Aug 2015 04:33:58 +0000 (+0000) Subject: www: minor cleanups to shorten code X-Git-Tag: v1.0.0~977 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=ded3c261112acf925567507959319a8442a3b647 www: minor cleanups to shorten code Less scrolling is more efficient. --- diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index d1ee2ff0..527d2131 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -138,7 +138,6 @@ sub mid2blob { my $path = PublicInbox::MID::mid2path($ctx->{mid}); my @cmd = ('git', "--git-dir=$ctx->{git_dir}", qw(cat-file blob), "HEAD:$path"); - my $cmd = join(' ', @cmd); my $pid = open my $fh, '-|'; defined $pid or die "fork failed: $!\n"; if ($pid == 0) { @@ -162,8 +161,7 @@ sub get_mid_txt { # /$LISTNAME/m/$MESSAGE_ID.html -> HTML content (short quotes) sub get_mid_html { my ($ctx) = @_; - my $x = mid2blob($ctx); - return r404() unless $x; + my $x = mid2blob($ctx) or return r404(); require PublicInbox::View; my $pfx = msg_pfx($ctx); @@ -178,8 +176,8 @@ sub get_mid_html { # /$LISTNAME/f/$MESSAGE_ID.html -> HTML content (fullquotes) sub get_full_html { my ($ctx) = @_; - my $x = mid2blob($ctx); - return r404() unless $x; + my $x = mid2blob($ctx) or return r404(); + require PublicInbox::View; my $foot = footer($ctx); require Email::MIME;