NAME

Net::ENUM - E.164 NUmber Mapping

SYNOPSIS

use Net::ENUM;

my $net_enum = Net::ENUM->new(
  udp_timeout => 5,
);

# returns contact of first NAPTR entry (after sorting by 'order') the RegEx
# is already done!
my $contact_1 = $net_enum->get_enum_address( '+123 456-789' );

# the same as above, but takes the first 'sip' entry
my $contact_2 = $net_enum->get_enum_address( '+123 456-789', 'order', 'sip' );

# returns an array with all NAPTR entries (each a hash) sorted by 'name'
my @contact_array = $net_enum->get_enum_address( '+123 456-789', 'name' );

# error output
if ( $net_enum->{'enum_error'} ) {
  print $net_enum->{'enum_error'};
}
else {
  # if there is a second entry in the array ([1]) this will print:
  # 9.8.7.6.5.4.3.2.1.e164.arpa
  print $contact_array[1]->{'name'};
}

DESCRIPTION

This module is used to get the wanted NAPTR or Internet address of a given ENUM.

CONSTRUCTOR

new ( %ARGS )

This creates a new ENUM object.

%ARGS are the same as of Net::DNS::Resolver->new(%args). %ARGS can overwrite Net::ENUM default values!

METHODS

get_enum_address ( NUMBER, SORTBY, MEDIA )

NUMBER is a qualified international phone number starting with '+'.

SORTBY sorts NAPTR based on this attribute, defaults to 'order' (= lowest to highest order, for same order lowest preference first).

MEDIA is the NAPTR media to return ('sip', 'tel', 'email', ...), defaults to return all types.

Return: - If an array is wanted it returns an array with all sorted NAPTR entries, each one in a hash. Keys in the hash are: flags, ttl ,name, service, rdata, preference, rdlength, regexp, order, type, class, replacement - If a string is wanted it returns a string with the Internet protocol address of the first NAPTR entry (after sorting and selecting media). The RegEx is already done on the NUMBER! - <undef> on error. The error message is stored in $self->{'enum_error'}.

get_nameservers ( DOMAIN )

DOMAIN must be a full qualified domain. In our case it should look like: 9.8.7.6.5.4.3.2.1.e164.arpa

Return: - an arrayref with nameservers found for this domain. - <undef> on error. The error message is stored in $self->{'enum_error'}.

number_to_domain ( NUMBER )

NUMBER can be a phone number in format: +123 456-789 or a e164.arpa domain.

Return: - the e164.arpa domain of NUMBER. In our example: 9.8.7.6.5.4.3.2.1.e164.arpa - <undef> on error. The error message is stored in $self->{'enum_error'}.

PREREQUISITES

This module requires the strict and the Net::DNS module to work.

SEE ALSO

perl(1), Net::DNS, Net::DNS::Resolver

COPYRIGHT

This module is Copyright (C) 2010 by Detlef Pilzecker.

All Rights Reserved.

This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.