The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::eNom::Role::Command::Domain - Domain Related Operations

SYNOPSIS

    use WWW::eNom;
    use WWW::eNom::Domain;

    my $api = WWW::eNom->new( ... );

    # Get a fully formed WWW::eNom::Domain object for a domain
    my $domain = $api->get_domain_by_name( 'drzigman.com' );


    # Check if a domain is locked
    if( $api->get_is_domain_locked_by_name( 'drzigman.com' ) ) {
        print "Domain is Locked!\n";
    }
    else {
        print "Domain is NOT Locked!\n";
    }

    # Lock Domain
    my $updated_domain = $api->enable_domain_lock_by_name( 'drzigman.com' );

    # Unlock Domain
    my $updated_domain = $api->disable_domain_lock_by_name( 'drzigman.com' );


    # Get domain authoritative nameservers
    for my $ns ( $api->get_domain_name_servers_by_name( 'drzigman.com' ) ) {
        print "Nameserver: $ns\n";
    }

    # Update Domain Nameservers
    my $updated_domain = $api->update_nameservers_for_domain_name({
        domain_name => 'drzigman.com',
        ns          => [ 'ns1.enom.org', 'ns2.enom.org' ],
    });


    # Get auto renew status
    if( $api->get_is_domain_auto_renew_by_name( 'drzigman.com' ) ) {
        print "Domain will be auto renewed!\n";
    }
    else {
        print "Domain will NOT be renewed automatically!\n";
    }

    # Enable domain auto renew
    my $updated_domain = $api->enable_domain_auto_renew_by_name( 'drzigman.com' );

    # Disable domain auto renew
    my $updated_domain = $api->disable_domain_auto_renew_by_name( 'drzigman.com' );

    # Renew Domain
    my $order_id = $api->renew_domain({
        domain_name => 'drzigman.com',
        years       => 1,
    });

    # Get Created Date
    my $created_date = $api->get_domain_created_date_by_name( 'drzigman.com' );
    print "This domain was created on: " . $created_date->ymd . "\n";

    # Email EPP Key to Registrant Contact
    try { $api->email_epp_key_by_name( 'drzigman.com' ) }
    catch {
        ...;
    };

REQUIRES

submit
get_contacts_by_domain_name

Needed in order to construct a full WWW::eNom::Domain object.

delete_private_nameserver

Needed in order to keep private nameservers and authoritative nameservers in sync.

DESCRIPTION

Implements domain related operations with the eNom API.

See Also

For Domain Registration please see WWW::eNom::Role::Command::Domain::Registration
For Domain Availability please see WWW::eNom::Role::Command::Domain::Availability

METHODS

get_domain_by_name

    my $domain = $api->get_domain_by_name( 'drzigman.com' );

At it's core, this is an Abstraction of the GetDomainInfo eNom API Call. However, because this API Call does not return enough information to fully populate a WWW::eNom::Domain object, internally the following additional methods are called:

"get_is_domain_auto_renew_by_name" in WWW::eNom::Role::Command::Domain
"get_is_domain_locked_by_name" in WWW::eNom::Role::Command::Domain
"get_domain_name_servers_by_name" in WWW::eNom::Role::Command::Domain
"get_domain_created_date_by_name" in WWW::eNom::Role::Command::Domain
"get_contacts_by_domain_name" in WWW::eNom::Role::Command::Contact

Because of all of these API calls this method can be fairly slow (usually about a second or two).

Given a FQDN, this method returns a fully formed WWW::eNom::Domain object. If the domain does not exist in your account (either because it's registered by someone else or it's available) this method will croak.

get_is_domain_locked_by_name

    if( $api->get_is_domain_locked_by_name( 'drzigman.com' ) ) {
        print "Domain is Locked!\n";
    }
    else {
        print "Domain is NOT Locked!\n";
    }

Abstraction of the GetRegLock eNom API Call. Given a FQDN, returns a truthy value if the domain is locked and falsey if it is not.

This method will croak if the domain is owned by someone else or if it is not registered.

enable_domain_lock_by_name

    my $updated_domain = $api->enable_domain_lock_by_name( 'drzigman.com' );

Abstraction of the SetRegLock eNom API Call. Given a FQDN, enables the registrar lock for the provided domain. If the domain is already locked this is effectively a NO OP.

This method will croak if the domain is owned by someone else or if it is not registered.

disable_domain_lock_by_name

    my $updated_domain = $api->disable_domain_lock_by_name( 'drzigman.com' );

Abstraction of the SetRegLock eNom API Call. Given a FQDN, disabled the registrar lock for the provided domain. If the domain is already unlocked this is effectively a NO OP.

This method will croak if the domain is owned by someone else or if it is not registered.

get_domain_name_servers_by_name

    for my $ns ( $api->get_domain_name_servers_by_name( 'drzigman.com' ) ) {
        print "Nameserver: $ns\n";
    }

Abstraction of the GetDNS eNom API Call. Given a FQDN, returns an ArrayRef of FQDNs that are the authoritative name servers for the specified FQDN.

This method will croak if the domain is owned by someone else or if it is not registered.

update_nameservers_for_domain_name

    my $updated_domain = $api->update_nameservers_for_domain_name({
        domain_name => 'drzigman.com',
        ns          => [ 'ns1.enom.org', 'ns2.enom.org' ],
    });

Abstraction of the ModifyNS eNom API Call. Given a FQDN and an ArrayRef of FQDNs to use as nameservers, updates the nameservers and returns an updated version WWW::eNom::Domain.

This method will croak if the domain is owned by someone else or if it is not registered. It will also croak if you provide an invalid nameserver (such as ns1.some-domain-that-does-not-really-exist.com).

NOTE If, during the update, you remove a private nameserver (by not including it in the ns ArrayRef) that private nameserver will be deleted. This is a limitation of eNom's API.

get_is_domain_auto_renew_by_name

    if( $api->get_is_domain_auto_renew_by_name( 'drzigman.com' ) ) {
        print "Domain will be auto renewed!\n";
    }
    else {
        print "Domain will NOT be renewed automatically!\n";
    }

Abstraction of the GetRenew eNom API Call. Given a FQDN, returns a truthy value if auto renew is enabled for this domain (you want eNom to automatically renew this) or a falsey value if auto renew is not enabled for this domain.

This method will croak if the domain is owned by someone else or if it is not registered.

enable_domain_auto_renew_by_name

    my $updated_domain = $api->enable_domain_auto_renew_by_name( 'drzigman.com' );

Abstraction of the SetRenew eNom API Call. Given a FQDN, enables auto renew for the provided domain. If the domain is already set to auto renew this is effectively a NO OP.

This method will croak if the domain is owned by someone else or if it is not registered.

disable_domain_auto_renew_by_name

    my $updated_domain = $api->disable_domain_auto_renew_by_name( 'drzigman.com' );

Abstraction of the SetRenew eNom API Call. Given a FQDN, disables auto renew for the provided domain. If the domain is already set not to auto renew this is effectively a NO OP.

This method will croak if the domain is owned by someone else or if it is not registered.

get_domain_created_date_by_name

    my $created_date = $api->get_domain_created_date_by_name( 'drzigman.com' );

    print "This domain was created on: " . $created_date->ymd . "\n";

Abstraction of the GetWhoisContact eNom API Call. Given a FQDN, returns a DateTime object representing when this domain registration was created.

This method will croak if the domain is owned by someone else or if it is not registered.

renew_domain

    my $order_id = $api->renew_domain({
        domain_name => 'drzigman.com',
        years       => 1,
    });

Abstraction of the Extend eNom API Call. Given a FQDN and the number of years, renews the domain for the requested number of years returning the order_id.

NOTE There is a limit as to how far into the future you can renew a domain (usually it's 10 years but that can vary based on the public suffix and the registry). In the event you try to renew too far into the future this method will croak with 'Requested renewal too long'

This method will croak if the domain is owned by someone else or if it is not registered.

email_epp_key_by_name

    try { $api->email_epp_key_by_name( 'drzigman.com' ) }
    catch {
        ...;
    };

Abstraction of the GetSubAccountPassword eNom API Call. Given a FQDN, emails the EPP Key to the email address listed for the registrant contact.

NOTE Unfortunately, eNom provides no API method to get the actual EPP Key. Instead, you must use this method to ask eNom to email the EPP Key to the registrant for you.