|
NAMENet::IPv4Addr - Perl extension for manipulating IPv4 addresses.SYNOPSISuse Net::IPv4Addr qw( :all ); my ($ip,$cidr) = ipv4_parse( "127.0.0.1/24" ); my ($ip,$cidr) = ipv4_parse( "192.168.100.10 / 255.255.255.0" ); my ($net,$msk) = ipv4_network( "192.168.100.30" ); my $broadcast = ipv4_broadcast( "192.168.100.30/26" ); if ( ipv4_in_network( "192.168.100.0", $her_ip ) ) { print "Welcome !"; } etc. DESCRIPTIONNet::IPv4Addr provides functions for parsing IPv4 addresses both in traditional address/netmask format and in the new CIDR format. There are also methods for calculating the network and broadcast address and also to see check if a given address is in a specific network.ADDRESSESAll of Net::IPv4Addr functions accepts addresses in many format. The parsing is very liberal.All these addresses would be accepted: 127.0.0.1 192.168.001.010/24 192.168.10.10/255.255.255.0 192.168.30.10 / 21 10.0.0.0 / 255.0.0.0 255.255.0.0 Those wouldn't though: 272.135.234.0 192.168/16 Most functions accepts the address and netmask or masklength in the same scalar value or as separate values. That is either my($ip,$masklength) = ipv4_parse($cidr_str); my($ip,$masklength) = ipv4_parse($ip_str,$msk_str); USINGNo functions are exported by default. Either use the ":all" tag to import them all or explicitly import those you need.FUNCTIONS
AUTHORFrancis J. Lacoste <francis.lacoste@iNsu.COM>COPYRIGHTCopyright (c) 1999, 2000 iNsu Innovations Inc. All rights reserved.This program is free software; you can redistribute it and/or modify it under the terms as perl itself. SEE ALSOperl(1) ipv4calc(1).
Visit the GSP FreeBSD Man Page Interface. |