The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSIS

  use Mail::RBL;

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

  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);

DESCRIPTION

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

->new(suffix)

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

->check($host)

$host can be either a hostname or an IP address. In the case of an IP Address, any trailing netmask (anything after a '/' character) will be ignored. 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.

->check_rhsbl($host)

Analogous to ->check(), but queries RHSBLs instead of IP-based lists. This is useful for using lists such as some of http://www.rfc-ignorant.org/.

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

HISTORY

1.00

Original version.

1.01

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.

AUTHOR

Luis E. Munoz <luismunoz@cpan.org>

SEE ALSO

perl(1).

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 117:

'=item' outside of any '=over'

Around line 219:

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