Net::RULI - Perl extension for RULI,


Net-RULI documentation Contained in the Net-RULI distribution.

Index


Code Index:

NAME

Top

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

SYNOPSIS

Top

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

Top

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

Top

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

Top

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

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

AUTHOR

Top

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

COPYRIGHT AND LICENSE

Top


Net-RULI documentation Contained in the Net-RULI distribution.

package Net::RULI;

use 5.008003;
use strict;
use warnings;
use Carp;

require Exporter;
use AutoLoader;

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration	use RULI ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
	
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(
	
);

our $VERSION = '0.03';

sub AUTOLOAD {
    # This AUTOLOAD is used to 'autoload' constants from the constant()
    # XS function.

    my $constname;
    our $AUTOLOAD;
    ($constname = $AUTOLOAD) =~ s/.*:://;
    croak "&RULI::constant not defined" if $constname eq 'constant';
    my ($error, $val) = constant($constname);
    if ($error) { croak $error; }
    {
	no strict 'refs';
	# Fixed between 5.005_53 and 5.005_61
#XXX	if ($] >= 5.00561) {
#XXX	    *$AUTOLOAD = sub () { $val };
#XXX	}
#XXX	else {
	    *$AUTOLOAD = sub { $val };
#XXX	}
    }
    goto &$AUTOLOAD;
}

require XSLoader;
XSLoader::load('Net::RULI', $VERSION);

# Preloaded methods go here.

# Autoload methods go after =cut, and are processed by the autosplit program.

1;
__END__
# Stub documentation for RULI module.