projects
/
spider.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ca9d4ac
)
add is_prefix and then use it
author
minima
<minima>
Sun, 27 Feb 2005 16:00:26 +0000
(16:00 +0000)
committer
minima
<minima>
Sun, 27 Feb 2005 16:00:26 +0000
(16:00 +0000)
perl/DXUtil.pm
patch
|
blob
|
history
perl/Spot.pm
patch
|
blob
|
history
diff --git
a/perl/DXUtil.pm
b/perl/DXUtil.pm
index 9f411812d6b2207d02d34b2de7581af78fe4314f..927df28baad7444e8224eb833e3033212308b974 100644
(file)
--- a/
perl/DXUtil.pm
+++ b/
perl/DXUtil.pm
@@
-30,6
+30,7
@@
require Exporter;
filecopy ptimelist
print_all_fields cltounix unpad is_callsign is_latlong
is_qra is_freq is_digits is_pctext is_pcflag insertitem deleteitem
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
);
);
@@
-363,6
+364,12
@@
sub is_callsign
$!x;
}
$!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
{
# check that a PC protocol field is valid text
sub is_pctext
{
diff --git
a/perl/Spot.pm
b/perl/Spot.pm
index 0ab1a5166f29996ab8f3217f02413f88a481325b..228804855ce97ed593076d479499aa1778a4e309 100644
(file)
--- a/
perl/Spot.pm
+++ b/
perl/Spot.pm
@@
-335,7
+335,7
@@
sub dup
$text =~ s/\%([0-9A-F][0-9A-F])/chr(hex($1))/eg;
$text = uc unpad($text);
my ($prefix) = $text =~ /\b(\w{1,4})$/;
$text =~ s/\%([0-9A-F][0-9A-F])/chr(hex($1))/eg;
$text = uc unpad($text);
my ($prefix) = $text =~ /\b(\w{1,4})$/;
- $text =~ s/\b\w{1,4}$// if $prefix &&
Prefix::extract
($prefix);
+ $text =~ s/\b\w{1,4}$// if $prefix &&
is_prefix
($prefix);
$text = substr($text, 0, $duplth) if length $text > $duplth;
$text = pack("C*", map {$_ & 127} unpack("C*", $text));
$text =~ s/[^\w]//g;
$text = substr($text, 0, $duplth) if length $text > $duplth;
$text = pack("C*", map {$_ & 127} unpack("C*", $text));
$text =~ s/[^\w]//g;