]> git.donarmstrong.com Git - debbugs.git/commitdiff
use state for read_bug field namemap
authorDon Armstrong <don@donarmstrong.com>
Fri, 23 Feb 2018 21:30:56 +0000 (13:30 -0800)
committerDon Armstrong <don@donarmstrong.com>
Fri, 23 Feb 2018 21:30:56 +0000 (13:30 -0800)
Debbugs/Status.pm

index 5a369982c9483b6e79d24f953cec38325410998a..9b59045aa848164b8966b0e115ecc91bf1465434 100644 (file)
@@ -245,7 +245,7 @@ sub read_bug{
         return undef;
     }
 
-    my %namemap = reverse %fields;
+    state $namemap = {reverse %fields};
     for my $line (@lines) {
         if ($line =~ /(\S+?): (.*)/) {
             my ($name, $value) = (lc $1, $2);
@@ -253,7 +253,7 @@ sub read_bug{
            # or \n in the fields of status. Kill them off here.
            # [Eventually, this should be superfluous.]
            $value =~ s/[\r\n]//g;
-           $data{$namemap{$name}} = $value if exists $namemap{$name};
+           $data{$namemap->{$name}} = $value if exists $namemap->{$name};
         }
     }
     for my $field (keys %fields) {