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

NAME

Net::RULI - Perl extension for RULI, a library for easily querying DNS SRV resource records

SYNOPSIS

use Net::RULI;

my $srv_list_ref = Net::RULI::ruli_sync_query($service, $domain, $fallback_port, $options);

my $srv_list_ref = Net::RULI::ruli_sync_smtp_query($domain, $options);

my $srv_list_ref = Net::RULI::ruli_sync_http_query($domain, $force_port, $options);

DESCRIPTION

RULI performs DNS queries for SRV records. The result is a ready-to-use list of SRV records. The whole logic demanded by SRV standards is already performed. It's the application role to try to contact every address in the given order.

This function performs a query for a generic service:

  my $srv_list_ref = Net::RULI::ruli_sync_query($service, $domain, 
                                                $fallback_port, $options);

This function performs a query for the SMTP service:

  my $srv_list_ref = Net::RULI::ruli_sync_smtp_query($domain, $options);

This function performs a query for the HTTP service:

  my $srv_list_ref = Net::RULI::ruli_sync_http_query($domain, $force_port, $options);

The $options field is currently unused and should be set to 0 (zero).

If the query fails for any reason, undef is returned by those functions.

EXAMPLES

Example 1

This example submits a generic query for FTP over TCP.

  my $srv_list_ref = Net::RULI::ruli_sync_query("_ftp._tcp", "bogus.tld", 
                                                21, 0);

Example 2

This example submits a specific query for SMTP.

  my $srv_list_ref = Net::RULI::ruli_sync_smtp_query("bogus.tld", 0);

Example 3

This example submits a specific query for HTTP.

  my $srv_list_ref = Net::RULI::ruli_sync_http_query("bogus.tld", -1, 0);

Example 4

This example scans the list of SRV records returned by successful calls to RULI functions.

  foreach (@$srv_list_ref) {
    my $target = $_->{target};
    my $priority = $_->{priority};
    my $weight = $_->{weight};
    my $port = $_->{port};
    my $addr_list_ref = $_->{addr_list};

    print "  target=$target priority=$priority weight=$weight port=$port addresses=";

    foreach (@$addr_list_ref) {
      print $_, " ";
    }
    print "\n";
  }

SEE ALSO

RFC 2782 - A DNS RR for specifying the location of services (DNS SRV)

RULI Web Site: http://www.nongnu.org/ruli/

AUTHOR

Everton da Silva Marques <everton.marques@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Everton da Silva Marques

RULI is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

RULI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with RULI; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.