X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUtil.pm;h=db52ad81076fa91d67a165b60adc8e567c58d8d9;hb=145f379500a27a90895aa3b0fbd8b63425e3c148;hp=705e5cc6c6eb02bdae3acf8eb003889182645205;hpb=e07645cec07ba739a20cc009d7dd138c962b66eb;p=spider.git diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 705e5cc6..db52ad81 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -16,10 +16,8 @@ use Data::Dumper; use strict; use vars qw($VERSION $BRANCH); -$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ ); -$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0)); -$main::build += $VERSION; -$main::branch += $BRANCH; + +main::mkver($VERSION = q$Revision$) if main->can('mkver'); use vars qw(@month %patmap @ISA @EXPORT); @@ -27,9 +25,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 +161,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 +362,11 @@ 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 {