Lorenzo Luconi Trombacchi > Net-DNS-Check-0.45 > Net::DNS::Check::Check

Download:
Net-DNS-Check-0.45.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

Net::DNS::Check::Check - OOP Perl module based on Net::DNS for domain name checking.

SYNOPSIS ^

 use Net::DNS::Check;

 my $dnscheck = new Net::DNS::Check(
        domain      => 'foo.com'
 );
 print ($dnscheck->check()?'OK':'FAILED');




 use Net::DNS::Check;
 use Net::DNS::Check::Config;

 my $config = new Net::DNS::Check::Config();
 $config->test_conf( test => 'soa_refresh_range', level => 'I');
 my $dnscheck = new Net::DNS::Check(
        domain      => 'foo.com',
        config          => $config,
        nserver         => 'ns.acme.com;ns2.acme.com=1.2.3.4',
        debug           => 1
 );
 print ($dnscheck->check()?'OK':'FAILED');

DESCRIPTION ^

Net::DNS::Check is a collection of OOP Perl modules allowing easy implementation of applications for domain name checking.

The Net::DNS::Check was built to be as easy as possible to use and highly configurable and flexible: it allow easy implementation of your custom test and deeper configuration of what you want to check and how.

Config Objects

A Config object is an instance of the Net::DNS::Check::Config class. With this object you can configure how Net::DNS::Check operates. You can set, for example, which test will be executed during the check phase, set the debug level and several other options. For additional information see Net::DNS::Check::Config.

Test Object

Net::DNS::Check::Test is the base class for test objects. A test is the single analysis that you can execute during the checking phase of a domain name. You can create a subclass of Net::DNS::Check::Test class and generate your custom test. For additional information see Net::DNS::Check::Test. At present these are the supported tests:

METHODS ^

new

This method creates a new Net::DNS::Check object and returns a reference to it. Arguments are passed as hash. The method "new" gives origin to all necessary queries.

check

With this method the check of the domain name starts. You'll get a true value if the check succeded or false otherwise.

test_summary

This method returns an hash containing the status and number of executed tests in that status.

For example if you have 3 tests in Warning status, 2 in Error status and 5 in OK status an hash like this will be given:

'W' => 3, 'E' => 2, 'OK' => 5

At present 4 different status are supported: OK, Warning (W), Error (E), Ignore (I). For additional information about status see Net::DNS::Check::Conf.

If an argument containing a specific status is passed, this method returns only the number of executed test in that status.

Examples:

        # $dnscheck is Net::DNS::Check object
        $dnscheck->check();

        # Print the number of test in OK status 
        print $dnscheck->test_summary('OK')


        # Return the hash of all the status
        # ********* ATTENZIONE attualmente riporta un hash reference, 
        # stabilire cosa e' meglio
        my %hash_status = $dnscheck->test_summary();

        foreach my $status ( keys %hash_status ) {
                print "$status: ". $hash_status{$status}."\n";
        }

check_status

This method returns "true" if the check succeede or otherwise "false".

nsauth

Returns the list (array) of the authoritative nameservers. Autoritative nameservers correspond to delegated nameservers (NS RR within the zone of the parent domain) or correspond to the nameservers passed with "nserver" argument in the method "new".

ns_status

This method returns status the information about the nameserver passed as argument. The nameserver must be one of the delegated nameservers. The status is "false" if no errors are found. If some problems to resolve the nameserver name are found or some errors are given during the query, this method returns an error string ("true" value):

error

This method return "false" if no errors are found during the check of the domain name. Otherwise it returns the error string ("true" value):

test_list

This method returns an array containing the name of executed tests or, if the status argument is passed, it returns the array of the test in a specific status. At present 4 different status are supported: OK, Warning (W), Error (E), Ignore (I). For additional information about status see Net::DNS::Check::Conf.

test_object

This method returns the reference to Net::DNS::Check::Test object specified as argument.

test_status

This method returns the status information about the test name passed as argument. At present there 4 different status are supported: OK, Warning (W), Error (E), Ignore (I). An OK status is returned if the test succeedes. One of the possibile other values, according to the configuration, is returned otherwise. For additional information about status see Net::DNS::Check::Config.

test_detail

This method returns detailed information about a test name passed as argument. It returns an hash in which keys are nameserver names (delegated nserver) and values are an hash point whose keys are "desc" or "status" and values are: for "desc", a text string containing a description of result and for "status" a "true" or "false" value depending on the test results.

Example of returned hash for 'soa_serial_syntax' test:

        %ret = (
                        'ns.foo.com' => {
                        'desc'          => '2005041700', 
                        'status'        => 1
                },
                        'ns.acme.net' => {
                        'desc'          => '20050320', 
                        'status'        => 0
                },
        );

Example:

    foreach my $test_name ( $dnscheck->test_list() ) {

        $result .= "\n$test_name: ".$dnscheck->test_status($test_name) ."\n";
        $result .= "==============================\n";
        my %test_detail = $dnscheck->test_detail($test_name);

        foreach my $ns_name ( keys %test_detail ) {
            if ( defined $test_detail{$ns_name}->{desc} ) {
                my $detail_status   = $test_detail{$ns_name}->{status};
                my $detail_desc     = $test_detail{$ns_name}->{desc};
                $result .= "$ns_name: Status: $detail_status Desc: $detail_desc\n";
            } 
        }

    }

domain

Returns the domain name passed as argument to the method "new".

COPYRIGHT ^

Copyright (c) 2005 Lorenzo Luconi Trombacchi - IIT-CNR

All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

perl(1)

syntax highlighting: