]> Sergey Matveev's repositories - public-inbox.git/commitdiff
msgmap: minor cleanup to move constant declaration
authorEric Wong <e@80x24.org>
Mon, 21 Sep 2015 11:11:07 +0000 (11:11 +0000)
committerEric Wong <e@80x24.org>
Mon, 21 Sep 2015 11:37:01 +0000 (11:37 +0000)
This doesn't actually change anything as the constant is still
usable in other subroutines, but helps with consistency and
readability IMHO.

lib/PublicInbox/Msgmap.pm

index 2f64d90c71f741cb100c3beacd124e2698260d71..f28579088e1ac78682915007873b0c8ef4766544 100644 (file)
@@ -84,10 +84,10 @@ sub mid_insert {
        $dbh->last_insert_id(undef, undef, 'msgmap', 'num');
 }
 
-use constant MID_FOR => 'SELECT mid FROM msgmap WHERE num = ? LIMIT 1';
 sub mid_for {
        my ($self, $num) = @_;
        my $dbh = $self->{dbh};
+       use constant MID_FOR => 'SELECT mid FROM msgmap WHERE num = ? LIMIT 1';
        my $sth = $self->{mid_for} ||= $dbh->prepare(MID_FOR);
        $sth->bind_param(1, $num);
        $sth->execute;