Net::DNS::GuessTZ - guess the time zone of a host


Net-DNS-GuessTZ documentation  | view source Contained in the Net-DNS-GuessTZ distribution.

Index


NAME

Top

Net::DNS::GuessTZ - guess the time zone of a host

VERSION

Top

version 0.002

SYNOPSIS

Top

  use Net::DNS::GuessTZ qw(tz_from_host);

  my $tz = tz_from_host('cr.yp.to');

DESCRIPTION

Top

Brazenly stolen from Plagger::Plugin::Filter::GuessTimeZoneByDomain, this module makes an effort to guess an appropriate time zone for a given host. It will look up the location of the IP addresses owner and it will also consider the country code top-level domain, if the host is under one.

CAVEATS

Top

This is fine if you don't really care too much about being correct. It's probably better than just always assuming local time.

Still, if possible, ask the user for his time zone when you can!

METHODS

Top

tz_from_host

  my $tz_name = Net::DNS::GuessTZ->tz_from_host($hostname, %arg);

This routine returns a guess at the given host's time zone, or false if no guess can be made.

Valid arguments are:

  priority   - which method to give priority to: "cc" or "ip"; default: ip
  ip_country - whether to check the IP address's owner with IP::Country;
               defaults to true

Unlike the Plagger plugin, this routine will gladly make a guess when the country it finds has more than three time zones.

COPYRIGHT

Top


Net-DNS-GuessTZ documentation  | view source Contained in the Net-DNS-GuessTZ distribution.