Commit 290cd8797bb4273cc5cd4e081f3dce84a4e95bd7

Authored by Athos
1 parent 566e55f8

improve iterations on hash keys

Showing 1 changed file with 3 additions and 7 deletions   Show diff stats
lib/CoprStatus.pm
... ... @@ -36,9 +36,7 @@ sub copr_info {
36 36 $info->{$package}->{'v5_version'} = $version if $status eq "succeeded";
37 37 }
38 38  
39   - foreach my $key (%{$info}) {
40   - next if(ref($key) eq 'HASH');
41   -
  39 + foreach my $key (keys %{$info}) {
42 40 my $spec = $ua->get("https://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico/raw/master/src/pkg-rpm/$key/$key.spec");
43 41 my $version = $1 if $spec->decoded_content =~ /^Version:\s*([^\s]+)\s*$/m;
44 42 if($version =~ /%\{version\}/) {
... ... @@ -56,8 +54,7 @@ sub copr_info {
56 54 sub compare_versions {
57 55 my $info = copr_info();
58 56 my $match = {};
59   - foreach my $key (%{$info}) {
60   - next if(ref($key) eq 'HASH');
  57 + foreach my $key (keys %{$info}) {
61 58 if($info->{$key}->{'v5_version'} eq $info->{$key}->{git_version}) {
62 59 $match->{$key} = 1;
63 60 }
... ... @@ -72,8 +69,7 @@ sub compare_versions {
72 69 sub info2html {
73 70 my $info = copr_info();
74 71 my $table_entries="";
75   - foreach my $key (%{$info}) {
76   - next if(ref($key) eq 'HASH');
  72 + foreach my $key (keys %{$info}) {
77 73 my $fill_v4_row;
78 74 my $fill_v5_row;
79 75 if($info->{$key}->{'v4_version'} eq $info->{$key}->{git_version}) {
... ...