NAME

Net::PortTest - Perl extension for running banner tests against INET services

SYNOPSIS

use Net::PortTest;

on 143 => sub {
    my $sock = shift;
    my $results = {};
    my $rc = -1;
  
    $results->{banner} = $sock->getline;
  
    $rc = 0
            if $results->{banner} =~ '^\* OK';
  
    return $rc, $results;
};

# alias some non standard ports to use the same
# test function

alias qw/ 10143 20143 / => 143;

my $results = run_tests '1.2.3.4' => 143;

# or, pass in an array of ports
$results = run_tests '1.2.3.4' => qw/ 143 10143 20143 /;

DESCRIPTION

This module is used as a framework for quickly and easily defining functions used to check internet services. The simplest examples are in the code, and they show how to execute a naiive IMAP banner check against an IP address.

EXPORT

This module will export the following functions into the main namespace:

run_tests, on and alias

when the module is loaded with:

use Net::PortTest ':all';

SEE ALSO

This module makes use of Net::Socket::INET for the communications with the external services.

Please submit all bugs via https://github.com/petermblair/Perl-CPAN/issues

AUTHOR

Peter Blair, <cpan@petermblair.com>

COPYRIGHT AND LICENSE

Copyright (C) 2013 by Peter Blair

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.