X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=927df28baad7444e8224eb833e3033212308b974;hb=fcabf1831276e7fd1db8eb16a4b6f220db6408e5;hp=705e5cc6c6eb02bdae3acf8eb003889182645205;hpb=e07645cec07ba739a20cc009d7dd138c962b66eb;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 705e5cc6..927df28b 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -27,9 +27,10 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(atime ztime cldate cldatetime slat slong yesno promptf parray parraypairs phex shellregex readfilestr writefilestr - filecopy + filecopy ptimelist print_all_fields cltounix unpad is_callsign is_latlong is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem + is_prefix ); @@ -162,6 +163,19 @@ sub phex return sprintf '%X', $val; } +# take an arg as a hash of call=>time pairs and print it +sub ptimelist +{ + my $ref = shift; + my $out; + for (sort keys %$ref) { + $out .= "$_=$ref->{$_}, "; + } + chop $out; + chop $out; + return $out; +} + # take an arg as an array list and print it sub parray { @@ -350,6 +364,12 @@ sub is_callsign $!x; } +sub is_prefix +{ + return $_[0] =~ m!^(?:[A-Z]{1,2}\d+ | \d[A-Z]{1,2}\d+)!x # basic prefix +} + + # check that a PC protocol field is valid text sub is_pctext {