projects
/
spider.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix simulanious connections
[spider.git]
/
perl
/
Prefix.pm
diff --git
a/perl/Prefix.pm
b/perl/Prefix.pm
index 8ea62b87fbda9e742fd0a481b925e753a9b2c65e..34f581d0e79d224db018d01557fca1a1bf373156 100644
(file)
--- a/
perl/Prefix.pm
+++ b/
perl/Prefix.pm
@@
-8,11
+8,11
@@
package Prefix;
package Prefix;
-use
Carp
;
+use
IO::File
;
use DXVars;
use DB_File;
use Data::Dumper;
use DXVars;
use DB_File;
use Data::Dumper;
-use
Carp
;
+use
DXDebug
;
use strict;
use vars qw($db %prefix_loc %pre);
use strict;
use vars qw($db %prefix_loc %pre);
@@
-40,7
+40,7
@@
sub load
sub store
{
my ($k, $l);
sub store
{
my ($k, $l);
- my $fh = new
FileHand
le;
+ my $fh = new
IO::Fi
le;
my $fn = "$main::data/prefix_data.pl";
confess "Prefix system not started" if !$db;
my $fn = "$main::data/prefix_data.pl";
confess "Prefix system not started" if !$db;
@@
-149,10
+149,12
@@
sub extract
# remove any /0-9 /P /A /M /MM /AM suffixes etc
if (@parts > 1) {
# remove any /0-9 /P /A /M /MM /AM suffixes etc
if (@parts > 1) {
+ $p = $parts[0];
+ shift @parts if $p =~ /^(WEB|NET)$/o;
$p = $parts[$#parts];
$p = $parts[$#parts];
- pop @parts if $p =~ /^(\d+|[
PABM]|AM|MM|BCN|SIX
|Q\w+)$/o;
+ pop @parts if $p =~ /^(\d+|[
JPABM]|AM|MM|BCN|JOTA|SIX|WEB|NET
|Q\w+)$/o;
$p = $parts[$#parts];
$p = $parts[$#parts];
- pop @parts if $p =~ /^(\d+|[
PABM]|AM|MM|BCN|SIX
|Q\w+)$/o;
+ pop @parts if $p =~ /^(\d+|[
JPABM]|AM|MM|BCN|JOTA|SIX|WEB|NET
|Q\w+)$/o;
# can we resolve them by direct lookup
foreach $p (@parts) {
# can we resolve them by direct lookup
foreach $p (@parts) {
@@
-186,6
+188,7
@@
my %valid = (
itu => '0,ITU',
cq => '0,CQ',
utcoff => '0,UTC offset',
itu => '0,ITU',
cq => '0,CQ',
utcoff => '0,UTC offset',
+ cont => '0,Continent',
);
no strict;
);
no strict;
@@
-198,6
+201,9
@@
sub AUTOLOAD
$name =~ s/.*:://o;
confess "Non-existant field '$AUTOLOAD'" if !$valid{$name};
$name =~ s/.*:://o;
confess "Non-existant field '$AUTOLOAD'" if !$valid{$name};
+ # this clever line of code creates a subroutine which takes over from autoload
+ # from OO Perl - Conway
+ *{$AUTOLOAD} = sub {@_ > 1 ? $_[0]->{$name} = $_[1] : $_[0]->{$name}} ;
if (@_) {
$self->{$name} = shift;
}
if (@_) {
$self->{$name} = shift;
}