X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=4ea3782ef4ccda85415b55a995cec44673cccdd9;hb=78953f794e49b311d2b2c84bb07c7b0f974278f9;hp=4246754832f4eb80fe99f7e5a77944e31b32844d;hpb=888290f339e2ee00894445fecb14f0b506d12368;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 42467548..4ea3782e 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,14 @@ 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 $_[0] =~ /^[\x09\x20-\xFF]+$/; + return undef if $_[0] =~ /[\x00-\x08\x0a-\x1f\x80-\x9f]/; + return $_[0]; } # check that a PC prot flag is fairly valid (doesn't check the difference between 1/0 and */-)