1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut synced 2025-06-07 10:35:41 -04:00
perlbuut/plugins/.svn/text-base/geoip.pm.svn-base
2009-12-05 00:02:04 -05:00

18 lines
393 B
Text

use Geo::IP;
sub {
my( $said, $pm ) = @_;
my $gi = Geo::IP->new(GEOIP_STANDARD);
print "Record for $said->{body}: ";
if( $said->{body} =~ /[a-zA-Z]/ ) {
print $gi->country_code_by_name( $said->{body} );
}
else {
print $gi->country_code_by_addr( $said->{body} );
}
}
__DATA__
geoip 192.168.32.45 or geoip example.com; returns the country associated with the resolved IP address.