Validate::Net(3pm)
π Validate::Net π
okay bestie, welcome to Validate::Net β the User Contributed Perl Documentation era of checking that your internet strings aren't lying to you. It's format validation for Net::-related strings, and it's lowkey the bouncer at the club door before your strings get handed off to the actual Net::* modules. π«Ά
β¨ NAME β¨
Validate::Net β format validation for Net::-related strings π
π SYNOPSIS π
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";
}
see how it justβ¦ tells you why?? no more mystery. we love a transparent king. π
πΈ DESCRIPTION πΈ
So Validate::Net is a class designed to assist with the validation of internet related strings. it's giving "helpful older sibling". You can use it to validate CGI forms, internally by modules, and in literally any place where you wanna check that an internet related string is valid before you hand it off to a Net::* module. π
The whole point? It lets you catch errors early, and with way more detailed error messages than you're likely to get further down in the Net::* modules. no more digging through eight layers of stack trace just to find out you typed a dot wrong. π
Whenever a test is false, you can access the reason through the reason method. yes bestie, it tells you the tea. π
π METHODS π
host $host π¦
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. two for one, we love efficiency.
domain $domain [, @options ] π
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'. π so yeah, that's a whole thing.
Depending on the options, additional checks may be made. No options are available at this time π β so like, it's the thought that counts.
ip $ip β
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. four numbers, three dots, no nonsense.
Depending on the options, additional checks may be made. No options are available at this time π β again, vibes only.
port $port π§
The port method is used to test for a valid port number. that's it, that's the whole method, and honestly? iconic.
π BUGS π
Unknown. ngl bestie, that's either extremely reassuring or extremely ominous and I cannot tell which. π₯
π TO DO π
This module is not all that completed. Just enough to do some basics. Feel free to send me patches to add anything you like. fr fr, the author said "send patches", that's a direct invitation. π
- Add support for networks π
- Add
"exists"support π - Add
"dns"support for host names π‘
π«Ά SUPPORT π«Ά
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. they're nice, I promise. β¨
π AUTHOR π
Adam Kennedy <adamk@cpan.org> β the main character, actually. π
π₯ SEE ALSO π₯
Net::* β the whole extended universe. π
π COPYRIGHT π
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. π
quick vibe check reminder: this page is from perl v5.36.0, dated 2022-11-19, and it's Validate::Net(3pm) β third section, manual page, perl-adjacent, no cap. π
β¨
okay that's the whole page bestie, go validate something and stay hydrated ππΈπ¦
π¦ where this page comes from
- debian bookworm: libvalidate-net-perl 0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libvalidate-net-perl 0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libvalidate-net-perl 0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libvalidate-net-perl 0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libvalidate-net-perl 0.6-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms