The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Geo::Details - Module to represent details of a geographical location

SYNOPSIS

    use Geo::Details;

    my $data = {
        ip            => '169.48.204.140',
        city          => 'Dallas',
        country       => 'US',
        country_name  => 'United States',
        hostname      => '8c.cc.30a9.ip4.static.sl-reverse.com',
        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: 192.168.1.1
    print $geo_details->city;         # Output: New York
    print $geo_details->country_name; # Output: United States

DESCRIPTION

Geo::Details is a simple module that represents details of a geographical location.

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.

abuse

    my $abuse_email = $geo_details->abuse();

Returns the abuse contact email address associated with the geographical location.

ip

    my $ip_address = $geo_details->ip();

Returns the IP address associated with the geographical location.

org

    my $organization = $geo_details->org();

Returns the organization associated with the geographical location.

domains

    my $domains_ref = $geo_details->domains();

Returns a reference to an array containing the domain names associated with the IP address.

privacy

    my $privacy_policy = $geo_details->privacy();

Returns the privacy policy related to the geographical location.

timezone

    my $timezone = $geo_details->timezone();

Returns the timezone information of the geographical location.

hostname

    my $hostname = $geo_details->hostname();

Returns the hostname associated with the IP address.

city

    my $city_name = $geo_details->city();

Returns the city name of the geographical location.

region

    my $region_name = $geo_details->region();

Returns the region or state name of the geographical location.

country

    my $country_code = $geo_details->country();

Returns the ISO 3166-1 alpha-2 code of the country associated with the geographical location.

country_name

    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_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).

loc

    my $location_string = $geo_details->loc();

Returns a string representing the latitude and longitude of the geographical location.

latitude

    my $latitude = $geo_details->latitude();

Returns the latitude coordinate of the geographical location.

longitude

    my $longitude = $geo_details->longitude();

Returns the longitude coordinate of the geographical location.

postal

    my $postal_code = $geo_details->postal();

Returns the postal or ZIP code associated with the geographical location.

asn

    my $asn_number = $geo_details->asn();

Returns the Autonomous System Number (ASN) associated with the IP address.

company

    my $company_name = $geo_details->company();

Returns the name of the company or organization associated with the geographical location.

carrier

    my $carrier_name = $geo_details->carrier();

Returns the name of the carrier or internet service provider (ISP) 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.