diff options
| author | Darkelarious <darkelarious@333networks.com> | 2017-08-22 11:00:13 +0200 |
|---|---|---|
| committer | Darkelarious <darkelarious@333networks.com> | 2017-08-22 11:00:13 +0200 |
| commit | c06322da38b4cb76b2036af1a5448083adb8ff20 (patch) | |
| tree | 189c9f0fec3325be927f763aba23cf18aa68cfe4 /lib/MasterServer/Core/Util.pm | |
| parent | e0d727670cbeda0db0812c5c9efc503d75f8d0a4 (diff) | |
| download | MasterServer-Perl-c06322da38b4cb76b2036af1a5448083adb8ff20.tar.gz MasterServer-Perl-c06322da38b4cb76b2036af1a5448083adb8ff20.zip | |
new server checking mechanism, complete recode of major functionsv2.4.0
Diffstat (limited to 'lib/MasterServer/Core/Util.pm')
| -rwxr-xr-x | lib/MasterServer/Core/Util.pm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/MasterServer/Core/Util.pm b/lib/MasterServer/Core/Util.pm index 682335c..5af8264 100755 --- a/lib/MasterServer/Core/Util.pm +++ b/lib/MasterServer/Core/Util.pm @@ -2,12 +2,28 @@ package MasterServer::Core::Util; use strict; use warnings; -use IP::Country::Fast; use Socket; +use Encode; +use IP::Country::Fast; use POSIX qw/strftime/; use Exporter 'import'; +our @EXPORT = qw| data2hashref + ip2country + host2ip + valid_address + db_all + sqlprint |; -our @EXPORT = qw| ip2country host2ip valid_address db_all sqlprint |; +################################################################################ +## process udp/tcp data strings from \key\value to hash +################################################################################ +sub data2hashref { + my ($self, $str) = @_; + my @a = split /\\/, encode('UTF-8', $str||""); + shift @a; + my %h = (@a, (scalar @a % 2 == 1) ? "dummy" : () ); + return \%h; +} ################################################################################ ## return the abbreviated country name based on IP |
