NAME
Geo::Details - Module to represent details of an IP returned by the Lite API
SYNOPSIS
use Geo::Details;
my $data = {
ip => '169.48.204.140',
city => 'Dallas',
country => 'United States',
country_code => 'US',
country_flag_url => 'https://example.com/us.png', # URL to the country flag image
# ... (other attributes)
};
my $geo_details = Geo::Details->new($data);
print $geo_details->ip; # Output: 169.48.204.140
print $geo_details->country_name; # Output: United States
DESCRIPTION
Geo::Details is a simple module that represents details of an IP returned by the Lite API.
METHODS
new
my $geo_details = Geo::Details->new($data, $key);
Creates a new Geo::Details object. If $data is a hash reference, it directly blesses it into the class and returns the object. If $data is a plain string, it creates a new hash reference with the specified key and sets the string value.
$key is an optional parameter used when $data is a plain string. It defaults to an empty string if not provided.
TO_JSON
This method is used to convert the object to a JSON representation.
ip
my $ip_address = $geo_details->ip();
Returns the IP address associated with the details.
country_code
my $country_code = $geo_details->country_code();
Returns the ISO 3166-1 alpha-2 code of the country associated with the geographical location.
country and country_name
my $country = $geo_details->country();
my $country_name = $geo_details->country_name();
Returns the full name of the country associated with the geographical location.
country_flag
my $country_flag_code = $geo_details->country_flag();
Returns the ISO 3166-1 alpha-2 code for the country flag associated with the geographical location.
country_flag_url
my $flag_url = $geo_details->country_flag_url();
Returns the URL to the country flag image associated with the geographical location.
country_currency
my $currency_code = $geo_details->country_currency();
Returns the currency code used in the country associated with the geographical location.
continent
my $continent_name = $geo_details->continent();
Returns the continent name of the geographical location.
continent_code
my $continent_code = $geo_details->continent();
Returns the continent code of the geographical location.
is_eu
my $is_eu_country = $geo_details->is_eu();
Returns true if the country associated with the geographical location is in the European Union (EU).
asn
my $asn_number = $geo_details->asn();
Returns the Autonomous System Number (ASN) associated with the IP address.
as_name
my $as_name = $geo_details->as_name();
Returns the name of Autonomous System associated with the IP address.
as_domain
my $as_domain = $geo_details->as_domain();
Returns the domain of Autonomous System associated with the IP address.
meta
my $meta_data_ref = $geo_details->meta();
Returns a reference to the meta-data hash containing additional information about the geographical location.
all
my $all_details_ref = $geo_details->all();
Returns a reference to the hash containing all the details of the geographical location.
AUTHOR
Your Name <your.email@example.com>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.