1IP(3)                 User Contributed Perl Documentation                IP(3)
2
3
4

NAME

6       NetAddr::IP - Manages IPv4 and IPv6 addresses and subnets
7

SYNOPSIS

9         use NetAddr::IP qw(
10               Compact
11               Coalesce
12               Zeros
13               Ones
14               V4mask
15               V4net
16               netlimit
17               :aton           DEPRECATED
18               :lower
19               :upper
20               :old_storable
21               :old_nth
22               :rfc3021
23         );
24
25         NOTE: NetAddr::IP::Util has a full complement of network address
26               utilities to convert back and forth between binary and text.
27
28               inet_aton, inet_ntoa, ipv6_aton, ipv6_ntoa
29               ipv6_n2x, ipv6_n2d inet_any2d, inet_n2dx,
30               inet_n2ad, inetanyto6, ipv6to4
31
32       See NetAddr::IP::Util
33
34         my $ip = new NetAddr::IP '127.0.0.1';
35                or if you prefer
36         my $ip = NetAddr::IP->new('127.0.0.1);
37               or from a packed IPv4 address
38         my $ip = new_from_aton NetAddr::IP (inet_aton('127.0.0.1'));
39               or from an octal filtered IPv4 address
40         my $ip = new_no NetAddr::IP '127.012.0.0';
41
42         print "The address is ", $ip->addr, " with mask ", $ip->mask, "\n" ;
43
44         if ($ip->within(new NetAddr::IP "127.0.0.0", "255.0.0.0")) {
45             print "Is a loopback address\n";
46         }
47
48                                       # This prints 127.0.0.1/32
49         print "You can also say $ip...\n";
50
51       * The following four functions return ipV6 representations of:
52
53         ::                                       = Zeros();
54         FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF  = Ones();
55         FFFF:FFFF:FFFF:FFFF:FFFF:FFFF::          = V4mask();
56         ::FFFF:FFFF                              = V4net();
57
58       ###### DEPRECATED, will be remove in version 5 ############
59
60         * To accept addresses in the format as returned by
61         inet_aton, invoke the module as:
62
63         use NetAddr::IP qw(:aton);
64
65       ###### USE new_from_aton instead ##########################
66
67       * To enable usage of legacy data files containing NetAddr::IP objects
68       stored using the Storable module.
69
70         use NetAddr::IP qw(:old_storable);
71
72       * To compact many smaller subnets (see:
73       "$me->compact($addr1,$addr2,...)"
74
75         @compacted_object_list = Compact(@object_list)
76
77       * Return a reference to list of "NetAddr::IP" subnets of $masklen mask
78       length, when $number or more addresses from @list_of_subnets are found
79       to be contained in said subnet.
80
81         $arrayref = Coalesce($masklen, $number, @list_of_subnets)
82
83       * By default NetAddr::IP functions and methods return string IPv6
84       addresses in uppercase.  To change that to lowercase:
85
86       NOTE: the AUGUST 2010 RFC5952 states:
87
88           4.3. Lowercase
89
90             The characters "a", "b", "c", "d", "e", and "f" in an IPv6
91             address MUST be represented in lowercase.
92
93       It is recommended that all NEW applications using NetAddr::IP be
94       invoked as shown on the next line.
95
96         use NetAddr::IP qw(:lower);
97
98       * To ensure the current IPv6 string case behavior even if the default
99       changes:
100
101         use NetAddr::IP qw(:upper);
102
103       * To set a limit on the size of nets processed or returned by
104       NetAddr::IP.
105
106       Set the maximum number of nets beyond which NetAddr::IP will return an
107       error as a power of 2 (default 16 or 65536 nets). Each 2**16 consumes
108       approximately 4 megs of memory. A 2**20 consumes 64 megs of memory, A
109       2**24 consumes 1 gigabyte of memory.
110
111         use NetAddr::IP qw(netlimit);
112         netlimit 20;
113
114       The maximum netlimit allowed is 2**24. Attempts to set limits below the
115       default of 16 or above the maximum of 24 are ignored.
116
117       Returns true on success, otherwise "undef".
118

INSTALLATION

120       Un-tar the distribution in an appropriate directory and type:
121
122               perl Makefile.PL
123               make
124               make test
125               make install
126
127       NetAddr::IP depends on NetAddr::IP::Util which installs by default with
128       its primary functions compiled using Perl's XS extensions to build a C
129       library. If you do not have a C complier available or would like the
130       slower Pure Perl version for some other reason, then type:
131
132               perl Makefile.PL -noxs
133               make
134               make test
135               make install
136

DESCRIPTION

138       This module provides an object-oriented abstraction on top of IP
139       addresses or IP subnets that allows for easy manipulations.  Version
140       4.xx of NetAddr::IP will work with older versions of Perl and is
141       compatible with Math::BigInt.
142
143       The internal representation of all IP objects is in 128 bit IPv6
144       notation.  IPv4 and IPv6 objects may be freely mixed.
145
146   Overloaded Operators
147       Many operators have been overloaded, as described below:
148
149       Assignment ("=")
150           Has been optimized to copy one NetAddr::IP object to another very
151           quickly.
152
153       "->copy()"
154           The assignment ("=") operation is only put in to operation when the
155           copied object is further mutated by another overloaded operation.
156           See overload SPECIAL SYMBOLS FOR "use overload" for details.
157
158           "->copy()" actually creates a new object when called.
159
160       Stringification
161           An object can be used just as a string. For instance, the following
162           code
163
164                   my $ip = new NetAddr::IP '192.168.1.123';
165                   print "$ip\n";
166
167           Will print the string 192.168.1.123/32.
168
169       Equality
170           You can test for equality with either "eq" or "==". "eq" allows
171           comparison with arbitrary strings as well as NetAddr::IP objects.
172           The following example:
173
174               if (NetAddr::IP->new('127.0.0.1','255.0.0.0') eq '127.0.0.1/8')
175                  { print "Yes\n"; }
176
177           will print out "Yes".
178
179           Comparison with "==" requires both operands to be NetAddr::IP
180           objects.
181
182           In both cases, a true value is returned if the CIDR representation
183           of the operands is equal.
184
185       Comparison via >, <, >=, <=, <=> and "cmp"
186           Internally, all network objects are represented in 128 bit format.
187           The numeric representation of the network is compared through the
188           corresponding operation. Comparisons are tried first on the address
189           portion of the object and if that is equal then the NUMERIC cidr
190           portion of the masks are compared. This leads to the
191           counterintuitive result that
192
193                   /24 > /16
194
195           Comparison should not be done on netaddr objects with different
196           CIDR as this may produce indeterminate - unexpected results, rather
197           the determination of which netblock is larger or smaller should be
198           done by comparing
199
200                   $ip1->masklen <=> $ip2->masklen
201
202       Addition of a constant ("+")
203           Add a 32 bit signed constant to the address part of a NetAddr
204           object.  This operation changes the address part to point so many
205           hosts above the current objects start address. For instance, this
206           code:
207
208               print NetAddr::IP->new('127.0.0.1/8') + 5;
209
210           will output 127.0.0.6/8. The address will wrap around at the
211           broadcast back to the network address. This code:
212
213               print NetAddr::IP->new('10.0.0.1/24') + 255;
214
215               outputs 10.0.0.0/24.
216
217           Returns the the unchanged object when the constant is missing or
218           out of range.
219
220               2147483647 <= constant >= -2147483648
221
222       Subtraction of a constant ("-")
223           The complement of the addition of a constant.
224
225       Difference ("-")
226           Returns the difference between the address parts of two NetAddr::IP
227           objects address parts as a 32 bit signed number.
228
229           Returns undef if the difference is out of range.
230
231           (See range restrictions on Addition above)
232
233       Auto-increment
234           Auto-incrementing a NetAddr::IP object causes the address part to
235           be adjusted to the next host address within the subnet. It will
236           wrap at the broadcast address and start again from the network
237           address.
238
239       Auto-decrement
240           Auto-decrementing a NetAddr::IP object performs exactly the
241           opposite of auto-incrementing it, as you would expect.
242
243   Serializing and Deserializing
244       This module defines hooks to collaborate with Storable for serializing
245       "NetAddr::IP" objects, through compact and human readable strings. You
246       can revert to the old format by invoking this module as
247
248         use NetAddr::IP ':old_storable';
249
250       You must do this if you have legacy data files containing NetAddr::IP
251       objects stored using the Storable module.
252
253   Methods
254       "->new([$addr, [ $mask|IPv6 ]])"
255       "->new6([$addr, [ $mask]])"
256       "->new_no([$addr, [ $mask]])"
257       "->new_from_aton($netaddr)"
258       new_cis and new_cis6 are DEPRECATED
259       "->new_cis("$addr $mask)"
260       "->new_cis6("$addr $mask)"
261           The first two methods create a new address with the supplied
262           address in $addr and an optional netmask $mask, which can be
263           omitted to get a /32 or /128 netmask for IPv4 / IPv6 addresses
264           respectively.
265
266           The third method "new_no" is exclusively for IPv4 addresses and
267           filters improperly formatted dot quad strings for leading 0's that
268           would normally be interpreted as octal format by NetAddr per the
269           specifications for inet_aton.
270
271           new_from_aton takes a packed IPv4 address and assumes a /32 mask.
272           This function replaces the DEPRECATED :aton functionality which is
273           fundamentally broken.
274
275           The last two methods new_cis and new_cis6 differ from new and new6
276           only in that they except the common Cisco address notation for
277           address/mask pairs with a space as a separator instead of a slash
278           (/)
279
280           These methods are DEPRECATED because the functionality is now
281           included in the other "new" methods
282
283             i.e.  ->new_cis('1.2.3.0 24')
284                   or
285                   ->new_cis6('::1.2.3.0 120')
286
287           "->new6" and "->new_cis6" mark the address as being in ipV6 address
288           space even if the format would suggest otherwise.
289
290             i.e.  ->new6('1.2.3.4') will result in ::102:304
291
292             addresses submitted to ->new in ipV6 notation will
293             remain in that notation permanently. i.e.
294                   ->new('::1.2.3.4') will result in ::102:304
295             whereas new('1.2.3.4') would print out as 1.2.3.4
296
297             See "STRINGIFICATION" below.
298
299           $addr can be almost anything that can be resolved to an IP address
300           in all the notations I have seen over time. It can optionally
301           contain the mask in CIDR notation.
302
303           prefix notation is understood, with the limitation that the range
304           specified by the prefix must match with a valid subnet.
305
306           Addresses in the same format returned by "inet_aton" or
307           "gethostbyname" can also be understood, although no mask can be
308           specified for them. The default is to not attempt to recognize this
309           format, as it seems to be seldom used.
310
311           To accept addresses in that format, invoke the module as in
312
313             use NetAddr::IP ':aton'
314
315           If called with no arguments, 'default' is assumed.
316
317           If called with an empty string as the argument, returns 'undef'
318
319           $addr can be any of the following and possibly more...
320
321             n.n
322             n.n/mm
323             n.n.n
324             n.n.n/mm
325             n.n.n.n
326             n.n.n.n/mm            32 bit cidr notation
327             n.n.n.n/m.m.m.m
328             loopback, localhost, broadcast, any, default
329             x.x.x.x/host
330             0xABCDEF, 0b111111000101011110, (a bcd number)
331             a netaddr as returned by 'inet_aton'
332
333           Any RFC1884 notation
334
335             ::n.n.n.n
336             ::n.n.n.n/mmm         128 bit cidr notation
337             ::n.n.n.n/::m.m.m.m
338             ::x:x
339             ::x:x/mmm
340             x:x:x:x:x:x:x:x
341             x:x:x:x:x:x:x:x/mmm
342             x:x:x:x:x:x:x:x/m:m:m:m:m:m:m:m any RFC1884 notation
343             loopback, localhost, unspecified, any, default
344             ::x:x/host
345             0xABCDEF, 0b111111000101011110 within the limits
346             of perl's number resolution
347             123456789012  a 'big' bcd number (bigger than perl likes)
348             and Math::BigInt
349
350           If called with no arguments, 'default' is assumed.
351
352           If called with an empty string as the argument, returns 'undef'
353
354       "->broadcast()"
355           Returns a new object referring to the broadcast address of a given
356           subnet. The broadcast address has all ones in all the bit positions
357           where the netmask has zero bits. This is normally used to address
358           all the hosts in a given subnet.
359
360       "->network()"
361           Returns a new object referring to the network address of a given
362           subnet. A network address has all zero bits where the bits of the
363           netmask are zero. Normally this is used to refer to a subnet.
364
365       "->addr()"
366           Returns a scalar with the address part of the object as an IPv4 or
367           IPv6 text string as appropriate. This is useful for printing or for
368           passing the address part of the NetAddr::IP object to other
369           components that expect an IP address. If the object is an ipV6
370           address or was created using ->new6($ip) it will be reported in
371           ipV6 hex format otherwise it will be reported in dot quad format
372           only if it resides in ipV4 address space.
373
374       "->mask()"
375           Returns a scalar with the mask as an IPv4 or IPv6 text string as
376           described above.
377
378       "->masklen()"
379           Returns a scalar the number of one bits in the mask.
380
381       "->bits()"
382           Returns the width of the address in bits. Normally 32 for v4 and
383           128 for v6.
384
385       "->version()"
386           Returns the version of the address or subnet. Currently this can be
387           either 4 or 6.
388
389       "->cidr()"
390           Returns a scalar with the address and mask in CIDR notation. A
391           NetAddr::IP object stringifies to the result of this function.
392           (see comments about ->new6() and ->addr() for output formats)
393
394       "->aton()"
395           Returns the address part of the NetAddr::IP object in the same
396           format as the "inet_aton()" or "ipv6_aton" function respectively.
397           If the object was created using ->new6($ip), the address returned
398           will always be in ipV6 format, even for addresses in ipV4 address
399           space.
400
401       "->range()"
402           Returns a scalar with the base address and the broadcast address
403           separated by a dash and spaces. This is called range notation.
404
405       "->prefix()"
406           Returns a scalar with the address and mask in ipV4 prefix
407           representation. This is useful for some programs, which expect its
408           input to be in this format. This method will include the broadcast
409           address in the encoding.
410
411       "->nprefix()"
412           Just as "->prefix()", but does not include the broadcast address.
413
414       "->numeric()"
415           When called in a scalar context, will return a numeric
416           representation of the address part of the IP address. When called
417           in an array contest, it returns a list of two elements. The first
418           element is as described, the second element is the numeric
419           representation of the netmask.
420
421           This method is essential for serializing the representation of a
422           subnet.
423
424       "->bigint()"
425           When called in scalar context, will return a Math::BigInt
426           representation of the address part of the IP address. When called
427           in an array context, it returns a list of two elements, The first
428           element is as described, the second element is the Math::BigInt
429           representation of the netmask.
430
431       "->wildcard()"
432           When called in a scalar context, returns the wildcard bits
433           corresponding to the mask, in dotted-quad or ipV6 format as
434           applicable.
435
436           When called in an array context, returns a two-element array. The
437           first element, is the address part. The second element, is the
438           wildcard translation of the mask.
439
440       "->short()"
441           Returns the address part in a short or compact notation.
442
443             (ie, 127.0.0.1 becomes 127.1).
444
445           Works with both, V4 and V6.
446
447       "->full()"
448           Returns the address part in FULL notation for ipV4 and ipV6
449           respectively.
450
451             i.e. for ipV4
452               0000:0000:0000:0000:0000:0000:127.0.0.1
453
454                  for ipV6
455               0000:0000:0000:0000:0000:0000:0000:0000
456
457           To force ipV4 addresses into full ipV6 format use:
458
459       "->full6()"
460           Returns the address part in FULL ipV6 notation
461
462       "$me->contains($other)"
463           Returns true when $me completely contains $other. False is returned
464           otherwise and "undef" is returned if $me and $other are not both
465           "NetAddr::IP" objects.
466
467       "$me->within($other)"
468           The complement of "->contains()". Returns true when $me is
469           completely contained within $other.
470
471           Note that $me and $other must be "NetAddr::IP" objects.
472
473       C->is_rfc1918()>
474           Returns true when $me is an RFC 1918 address.
475
476             10.0.0.0      -   10.255.255.255  (10/8 prefix)
477             172.16.0.0    -   172.31.255.255  (172.16/12 prefix)
478             192.168.0.0   -   192.168.255.255 (192.168/16 prefix)
479
480       "->splitref($bits,[optional $bits1,$bits2,...])"
481           Returns a reference to a list of objects, representing subnets of
482           "bits" mask produced by splitting the original object, which is
483           left unchanged. Note that $bits must be longer than the original
484           mask in order for it to be splittable.
485
486           ERROR conditions:
487
488             ->splitref will DIE with the message 'netlimit exceeded'
489               if the number of return objects exceeds 'netlimit'.
490               See function 'netlimit' above (default 2**16 or 65536 nets).
491
492             ->splitref returns undef when C<bits> or the (bits list)
493               will not fit within the original object.
494
495             ->splitref returns undef if a supplied ipV4, ipV6, or NetAddr
496               mask in inappropriately formatted,
497
498           bits may be a CIDR mask, a dot quad or ipV6 string or a NetAddr::IP
499           object.  If "bits" is missing, the object is split for into all
500           available addresses within the ipV4 or ipV6 object ( auto-mask of
501           CIDR 32, 128 respectively ).
502
503           With optional additional "bits" list, the original object is split
504           into parts sized based on the list. NOTE: a short list will
505           replicate the last item. If the last item is too large to for what
506           remains of the object after splitting off the first parts of the
507           list, a "best fits" list of remaining objects will be returned
508           based on an increasing sort of the CIDR values of the "bits" list.
509
510             i.e.  my $ip = new NetAddr::IP('192.168.0.0/24');
511                   my $objptr = $ip->split(28, 29, 28, 29, 26);
512
513              has split plan 28 29 28 29 26 26 26 28
514              and returns this list of objects
515
516                   192.168.0.0/28
517                   192.168.0.16/29
518                   192.168.0.24/28
519                   192.168.0.40/29
520                   192.168.0.48/26
521                   192.168.0.112/26
522                   192.168.0.176/26
523                   192.168.0.240/28
524
525           NOTE: that /26 replicates twice beyond the original request and /28
526           fills the remaining return object requirement.
527
528       "->rsplitref($bits,[optional $bits1,$bits2,...])"
529           "->rsplitref" is the same as "->splitref" above except that the
530           split plan is applied to the original object in reverse order.
531
532             i.e.  my $ip = new NetAddr::IP('192.168.0.0/24');
533                   my @objects = $ip->split(28, 29, 28, 29, 26);
534
535              has split plan 28 26 26 26 29 28 29 28
536              and returns this list of objects
537
538                   192.168.0.0/28
539                   192.168.0.16/26
540                   192.168.0.80/26
541                   192.168.0.144/26
542                   192.168.0.208/29
543                   192.168.0.216/28
544                   192.168.0.232/29
545                   192.168.0.240/28
546
547       "->split($bits,[optional $bits1,$bits2,...])"
548           Similar to "->splitref" above but returns the list rather than a
549           list reference. You may not want to use this if a large number of
550           objects is expected.
551
552       "->rsplit($bits,[optional $bits1,$bits2,...])"
553           Similar to "->rsplitref" above but returns the list rather than a
554           list reference. You may not want to use this if a large number of
555           objects is expected.
556
557       "->hostenum()"
558           Returns the list of hosts within a subnet.
559
560           ERROR conditions:
561
562             ->hostenum will DIE with the message 'netlimit exceeded'
563               if the number of return objects exceeds 'netlimit'.
564               See function 'netlimit' above (default 2**16 or 65536 nets).
565
566       "->hostenumref()"
567           Faster version of "->hostenum()", returning a reference to a list.
568
569           NOTE: hostenum and hostenumref report zero (0) useable hosts in a
570           /31 network. This is the behavior expected prior to RFC 3021. To
571           report 2 useable hosts for use in point-to-point networks, use
572           :rfc3021 tag.
573
574                   use NetAddr::IP qw(:rfc3021);
575
576           This will cause hostenum and hostenumref to return two (2) useable
577           hosts in a /31 network.
578
579       "$me->compact($addr1, $addr2, ...)"
580       "@compacted_object_list = Compact(@object_list)"
581           Given a list of objects (including $me), this method will compact
582           all the addresses and subnets into the largest (ie, least specific)
583           subnets possible that contain exactly all of the given objects.
584
585           Note that in versions prior to 3.02, if fed with the same IP
586           subnets multiple times, these subnets would be returned. From 3.02
587           on, a more "correct" approach has been adopted and only one address
588           would be returned.
589
590           Note that $me and all $addr's must be "NetAddr::IP" objects.
591
592       "$me->compactref(\@list)"
593       "$compacted_object_list = Compact(\@list)"
594           As usual, a faster version of "->compact()" that returns a
595           reference to a list. Note that this method takes a reference to a
596           list instead.
597
598           Note that $me must be a "NetAddr::IP" object.
599
600       "$me->coalesce($masklen, $number, @list_of_subnets)"
601       "$arrayref = Coalesce($masklen,$number,@list_of_subnets)"
602           Will return a reference to list of "NetAddr::IP" subnets of
603           $masklen mask length, when $number or more addresses from
604           @list_of_subnets are found to be contained in said subnet.
605
606           Subnets from @list_of_subnets with a mask shorter than $masklen are
607           passed "as is" to the return list.
608
609           Subnets from @list_of_subnets with a mask longer than $masklen will
610           be counted (actually, the number of IP addresses is counted)
611           towards $number.
612
613           Called as a method, the array will include $me.
614
615           WARNING: the list of subnet must be the same type. i.e ipV4 or ipV6
616
617       "->first()"
618           Returns a new object representing the first usable IP address
619           within the subnet (ie, the first host address).
620
621       "->last()"
622           Returns a new object representing the last usable IP address within
623           the subnet (ie, one less than the broadcast address).
624
625       "->nth($index)"
626           Returns a new object representing the n-th usable IP address within
627           the subnet (ie, the n-th host address).  If no address is available
628           (for example, when the network is too small for $index hosts),
629           "undef" is returned.
630
631           Version 4.00 of NetAddr::IP and version 1.00 of NetAddr::IP::Lite
632           implements "->nth($index)" and "->num()" exactly as the
633           documentation states.  Previous versions behaved slightly
634           differently and not in a consistent manner. See the README file for
635           details.
636
637           To use the old behavior for "->nth($index)" and "->num()":
638
639             use NetAddr::IP::Lite qw(:old_nth);
640
641             old behavior:
642             NetAddr::IP->new('10/32')->nth(0) == undef
643             NetAddr::IP->new('10/32')->nth(1) == undef
644             NetAddr::IP->new('10/31')->nth(0) == undef
645             NetAddr::IP->new('10/31')->nth(1) == 10.0.0.1/31
646             NetAddr::IP->new('10/30')->nth(0) == undef
647             NetAddr::IP->new('10/30')->nth(1) == 10.0.0.1/30
648             NetAddr::IP->new('10/30')->nth(2) == 10.0.0.2/30
649             NetAddr::IP->new('10/30')->nth(3) == 10.0.0.3/30
650
651           Note that in each case, the broadcast address is represented in the
652           output set and that the 'zero'th index is alway undef except for a
653           point-to-point /31 or /127 network where there are exactly two
654           addresses in the network.
655
656             new behavior:
657             NetAddr::IP->new('10/32')->nth(0)  == 10.0.0.0/32
658             NetAddr::IP->new('10.1/32'->nth(0) == 10.0.0.1/32
659             NetAddr::IP->new('10/31')->nth(0)  == 10.0.0.0/32
660             NetAddr::IP->new('10/31')->nth(1)  == 10.0.0.1/32
661             NetAddr::IP->new('10/30')->nth(0) == 10.0.0.1/30
662             NetAddr::IP->new('10/30')->nth(1) == 10.0.0.2/30
663             NetAddr::IP->new('10/30')->nth(2) == undef
664
665           Note that a /32 net always has 1 usable address while a /31 has
666           exactly two usable addresses for point-to-point addressing. The
667           first index (0) returns the address immediately following the
668           network address except for a /31 or /127 when it return the network
669           address.
670
671       "->num()"
672           As of version 4.42 of NetAddr::IP and version 1.27 of
673           NetAddr::IP::Lite a /31 and /127 with return a net num value of 2
674           instead of 0 (zero) for point-to-point networks.
675
676           Version 4.00 of NetAddr::IP and version 1.00 of NetAddr::IP::Lite
677           return the number of usable IP addresses within the subnet, not
678           counting the broadcast or network address.
679
680           Previous versions worked only for ipV4 addresses, returned a
681           maximum span of 2**32 and returned the number of IP addresses not
682           counting the broadcast address.
683                   (one greater than the new behavior)
684
685           To use the old behavior for "->nth($index)" and "->num()":
686
687             use NetAddr::IP::Lite qw(:old_nth);
688
689           WARNING:
690
691           NetAddr::IP will calculate and return a numeric string for network
692           ranges as large as 2**128. These values are TEXT strings and perl
693           can treat them as integers for numeric calculations.
694
695           Perl on 32 bit platforms only handles integer numbers up to 2**32
696           and on 64 bit platforms to 2**64.
697
698           If you wish to manipulate numeric strings returned by NetAddr::IP
699           that are larger than 2**32 or 2**64, respectively,  you must load
700           additional modules such as Math::BigInt, bignum or some similar
701           package to do the integer math.
702
703       "->re()"
704           Returns a Perl regular expression that will match an IP address
705           within the given subnet. Defaults to ipV4 notation. Will return an
706           ipV6 regex if the address in not in ipV4 space.
707
708       "->re6()"
709           Returns a Perl regular expression that will match an IP address
710           within the given subnet. Always returns an ipV6 regex.
711

EXPORT_OK

713               Compact
714               Coalesce
715               Zeros
716               Ones
717               V4mask
718               V4net
719               netlimit
720

NOTES / BUGS ... FEATURES

722       NetAddr::IP only runs in Pure Perl mode on Windows boxes because I
723       don't have the resources or know how to get the "configure" stuff
724       working in the Windows environment. Volunteers WELCOME to port the "C"
725       portion of this module to Windows.
726

HISTORY

728           See the Changes file
729

AUTHORS

731       Luis E. Mun~oz <luismunoz@cpan.org>, Michael Robinton
732       <michael@bizsystems.com>
733

WARRANTY

735       This software comes with the same warranty as Perl itself (ie, none),
736       so by using it you accept any and all the liability.
737
739       This software is (c) Luis E. Mun~oz, 1999 - 2007, and (c) Michael
740       Robinton, 2006 - 2012.
741
742       All rights reserved.
743
744       This program is free software; you can redistribute it and/or modify it
745       under the terms of either:
746
747         a) the GNU General Public License as published by the Free
748         Software Foundation; either version 2, or (at your option) any
749         later version, or
750
751         b) the "Artistic License" which comes with this distribution.
752
753       This program is distributed in the hope that it will be useful, but
754       WITHOUT ANY WARRANTY; without even the implied warranty of
755       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
756       GNU General Public License or the Artistic License for more details.
757
758       You should have received a copy of the Artistic License with this
759       distribution, in the file named "Artistic".  If not, I'll be glad to
760       provide one.
761
762       You should also have received a copy of the GNU General Public License
763       along with this program in the file named "Copying". If not, write to
764       the
765
766               Free Software Foundation, Inc.
767               51 Franklin Street, Fifth Floor
768               Boston, MA 02110-1301 USA.
769
770       or visit their web page on the internet at:
771
772               http://www.gnu.org/copyleft/gpl.html.
773

SEE ALSO

775         perl(1) L<NetAddr::IP::Lite>, L<NetAddr::IP::Util>,
776       L<NetAddr::IP::InetBase>
777
778
779
780perl v5.16.3                      2013-04-09                             IP(3)
Impressum