Mail::RBL - Perl extension to access RBL-style host verification services


  use Mail::RBL;

  my $list = new Mail::RBL('');

  # You can also specify a resolver to use with Net::DNS::Resolver

  my $list = new Mail::RBL('', $res);

  if ($list->check($host)) {
      print "$host is in the list";

  my ($ip_result, $optional_info_txt) = $list->check($host);
  # $optional_info_txt will be undef if the list does not provide TXT
  # RRs along with the A RRs.

  print "The list says ", ($list->check($host))[1], " in its TXT RR\n";

  my ($ip_result, $optional_info_txt) = $list->check_rhsbl($hostname);


This module eases the task of checking if a given host is in the list. The methods available are described below:

->new(suffix, resolver)

Creates a list handle. The suffix parameter is mandatory and specifies which suffix to append to the queries. If left unspecified, defaults to

An optional DNS resolver can be specified. An object of the Net::DNS::Resolver(3) class is expected.


$host can be either a hostname or an IP address. In the case of an IP Address. In the case of a hostname, all the IP addresses will be looked up and checked against the list. If any of the addresses is in the list, the host will be considered in the list as a whole.

Returns either a NetAddr::IP object as returned by the RBL itself, or undef in case the RBL does not supply an answer. This is important because many lists inject some semantics on the DNS response value, which now can be recovered easily with the program that uses this module.

In array context, any IP addresses are returned, followed by any TXT RR (or undef if none). If no match is found, an empty list is returned instead. In scalar context, only the first IP address (or undef) is returned.


Analogous to ->check(), but queries RHSBLs instead of IP-based lists. This is useful for using lists such as some of

Results and return values are the same as ->check().


  $Log:,v $
  Revision 1.10  2007/04/25 04:22:04  lem
  Finished adding support for the custom resolver code - Implementation
  was incomplete

  Revision 1.9  2006/12/08 00:01:14  lem
  Get version straight from the CVS revision.

  Revision 1.8  2006/12/07 23:58:07  lem
  Allow the user to provide a Net::DNS::Resolver object to perform DNS
  resolution - This allows finer control over how the queries are
  performed. Suggested by Eric Langheinrich.

Original version.


Minor bug fixes. Cleaned up MS-DOS line endings. Changed test cases (more and better tests). Now requires Test::More. More useful return values. Improved docs. First crypto-signed distribution of this module.


Luis E. Munoz <>


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

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 126:

'=item' outside of any '=over'

Around line 221:

You forgot a '=back' before '=head1'