diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-24 22:35:19 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-24 22:35:19 +0300 |
commit | 0b8f6e1e6251758ccdcc9bcf102a67a9e39dd54a (patch) | |
tree | ab186003cbf9e3a5a12726d3c461718f069ed3ec /whoseip/whoseip.pl | |
parent | 9aa788734ab432ef374e88cf550cb8577bdfbfc2 (diff) | |
download | dnstools-0b8f6e1e6251758ccdcc9bcf102a67a9e39dd54a.tar.gz dnstools-0b8f6e1e6251758ccdcc9bcf102a67a9e39dd54a.tar.bz2 |
Fix the mess with logical conjunction and disjunction
Diffstat (limited to 'whoseip/whoseip.pl')
-rw-r--r-- | whoseip/whoseip.pl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/whoseip/whoseip.pl b/whoseip/whoseip.pl index 225a159..fe41ae0 100644 --- a/whoseip/whoseip.pl +++ b/whoseip/whoseip.pl @@ -183,19 +183,19 @@ sub arin_fmt { sub arin_decode { my ($input, $ref) = @_; - return if ($input =~ /^#/ or $input eq ''); + return if ($input =~ /^#/ || $input eq ''); if ($input =~ /^NetRange:\s+(.+)/) { my $r = $1; $r =~ s/\s+//g; my $n = range2count($r); - if (!defined($ref->{count}) or $ref->{count} > $n) { + if (!defined($ref->{count}) || $ref->{count} > $n) { $ref->{range} = $r; $ref->{cidr} = join ',', Net::CIDR::range2cidr($r); $ref->{count} = $n; delete $ref->{country} } - } elsif ($input =~ /^Country:\s+(.+)/ and !defined($ref->{country})) { + } elsif ($input =~ /^Country:\s+(.+)/ && !defined($ref->{country})) { $ref->{country} = $1; } } @@ -308,7 +308,7 @@ sub ntt_decode { my $r = $1; $r =~ s/\s+//g; my $c = range2count($r); - if (!defined($ref->{count}) or $ref->{count} > $c) { + if (!defined($ref->{count}) || $ref->{count} > $c) { $ref->{count} = $c; $ref->{range} = $r; $ref->{cidr} = join ',', Net::CIDR::range2cidr($r); @@ -359,7 +359,7 @@ sub nic_or_kr_decode { my $r = $1; $r =~ s/\s+//g; my $c = range2count($r); - if (!defined($ref->{count}) or $ref->{count} > $c) { + if (!defined($ref->{count}) || $ref->{count} > $c) { $ref->{count} = $c; $ref->{range} = $r; $ref->{cidr} = join ',', Net::CIDR::range2cidr($r); @@ -493,15 +493,15 @@ sub serve { } my $srv = findsrv($term); - if (defined($srv) and $srv ne 'UNKNOWN') { + if (defined($srv) && $srv ne 'UNKNOWN') { my %prev; while (%res = whois($term, $srv), - and defined($res{referto})) { + && defined($res{referto})) { %prev = %res if $res{status} = 'OK'; $srv = $res{referto}; } %res = %prev - if (!defined($res{country}) and defined($prev{country})); + if (!defined($res{country}) && defined($prev{country})); if (!defined($res{country})) { $res{status} = 'NO'; $res{diag} = 'IP unknown'; @@ -804,7 +804,7 @@ if (defined($fastcgi)) { $fastcgi = $0 =~ /\.fcgi$/; } -if (defined($output_format) and $output_format =~ /@(.+)/) { +if (defined($output_format) && $output_format =~ /@(.+)/) { abend(EX_USAGE, "format $1 not defined") unless defined $fmtab{$1}; $output_format = $fmtab{$1}; } |