GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Validate::Net(3) User Contributed Perl Documentation Validate::Net(3)

Validate::Net - Format validation for Net:: related strings

  use Validate::Net;

  my $good = '123.1.23.123';
  my $bad = '123.432.21.12';

  foreach ( $good, $bad ) {
        if ( Validate::Net->ip( $_ ) ) {
                print "'$_' is a valid ip\n";
        } else {
                print "'$_' is not a valid ip address because:\n";
                print Validate::Net->reason . "\n";
        }
  }

  my $checker = Validate::Net->new( 'fast' );
  unless ( $checker->host( 'foo.bar.blah' ) ) {
        print "You provided an invalid host";
  }

Validate::Net is a class designed to assist with the validation of internet related strings. It can be used to validate CGI forms, internally by modules, and in any place where you want to check that an internet related string is valid before handing it off to a Net::* modules.

It allows you to catch errors early, and with more detailed error messages than you are likely to get further down in the Net::* modules.

Whenever a test is false, you can access the reason through the "reason" method.

The "host" method is used to see if a value is a valid host. That is, it is either a domain name, or an ip address.

The "domain" method is used to check for a valid domain name according to RFC 1034. It additionally disallows two consective dashes 'foo--bar'. I've never seen it used, and it's probably a mistaken version of 'foo-bar'.

Depending on the options, additional checks may be made. No options are available at this time

The "ip" method is used to validate the format, of an ip address. If called with no options, it will just do a basic format check of the ip, checking that it conforms to the basic dotted quad format.

Depending on the options, additional checks may be made. No options are available at this time

The "port" method is used to test for a valid port number.

Unknown

This module is not all that completed. Just enough to do some basics. Feel free to send me patches to add anything you like.
Add support for networks
Add "exists" support
Add "dns" support for host names

Bugs should be reported via the CPAN bug tracking system

<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Validate-Net>

For other inquiries, contact the author

Adam Kennedy <adamk@cpan.org>

Net::*

Copyright 2002 - 2008 Adam Kennedy.

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

The full text of the license can be found in the LICENSE file included with this module.

2008-06-03 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.