X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=fc7cd024d7737a96326f8a4a69316069b8c696f4;hb=e3d9a376f71c1a517a8b6e99a79c3016fd5d8c5f;hp=ed714fe82c11b0862ef8d7051b4349e1e66f81d6;hpb=fa9e414f691e4e9a80c80eb54cb7b1e971976b22;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index ed714fe8..fc7cd024 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -165,7 +165,7 @@ sub phex sub parray { my $ref = shift; - return join(', ', @{$ref}); + return ref $ref ? join(', ', @{$ref}) : $ref; } # take the arg as an array reference and print as a list of pairs @@ -340,13 +340,13 @@ sub unpad # check that a field only has callsign characters in it sub is_callsign { - return $_[0] =~ /^(?:[A-Z]{1,2}\d+|\d[A-Z]\d+)[A-Z]{1,3}(?:-\d{1,2}|\/(?:[A-Z]{1,2}\d{0,2}|\d[A-Z]\d{0,2}))?$/; + return $_[0] =~ /^(?:[A-Z]{1,2}\d+|\d[A-Z]{1,2}\d+)[A-Z]{1,3}(?:-\d{1,2}|\/(?:[A-Z]{1,2}\d{0,2}|\d[A-Z]\d{0,2}))?$/; } # check that a PC protocol field is valid text sub is_pctext { - return undef if $_[0] =~ /[\x00-\x08\x0a-\x1f\xf0-\xff]/; + return undef if $_[0] =~ /[\x00-\x08\x0a-\x1f\x80-\x9f]/; return $_[0]; } @@ -371,7 +371,7 @@ sub is_digits # does it look like a qra locator? sub is_qra { - return $_[0] =~ /^[A-Za-z][A-Za-z]\d\d[A-Za-z][A-Za-z]$/o; + return $_[0] =~ /^[A-Ra-r][A-Ra-r]\d\d[A-Xa-x][A-Xa-x]$/; } # does it look like a valid lat/long