1Net::Works(3) User Contributed Perl Documentation Net::Works(3)
2
3
4
6 Net::Works - Sane APIs for IP addresses and networks
7
9 version 0.22
10
12 The NetAddr::IP module is very complete, correct, and useful. However,
13 its API design is a bit crufty. This distro provides an alternative API
14 that aims to address the biggest problems with that module's API, as
15 well as adding some additional features.
16
17 This distro contains two modules, Net::Works::Address and
18 Net::Works::Network.
19
20 NOTE: This distro's APIs are still in flux. Use at your own risk.
21
23 Here are some of the key differences between the two distributions:
24
25 • Separation of address from network
26
27 "Net::Works" provides two classes, one for single IP addresses and
28 one for networks (and subnets). With NetAddr::IP a single address
29 is represented as a /32 or /128 subnet. This is technically correct
30 but can make the API harder to use. Whenever you want a single IP
31 you're always stuck checking that the object you're working with is
32 the size of a single address subnet.
33
34 • Multiple constructors
35
36 Net::Works allows you to construct an IP address from a string
37 ("192.0.2.1") or an integer (3221225985) using separate
38 constructors.
39
40 • Next & previous IP
41
42 You can get the next and previous address from Net::Works::Address
43 object, regardless of whether or not that address is in the same
44 subnet.
45
46 • Constructors throw exceptions
47
48 If you pass bad data to a constructor you'll get an exception.
49
50 • Sane iterator and first/last
51
52 The iterator provided by Net::Works::Network has no confusing
53 special cases. It always returns all the addresses in a network,
54 including the network and broadcast addresses. Similarly, the
55 "$network->first()" and "$network->last()" do not return different
56 results for different sized networks.
57
58 • Split a range into subnets
59
60 The Net::Works::Network class provides a
61 "Net::Works::Network->range_as_subnets" method that takes a start
62 and end IP address and splits this into a set of subnets that
63 include all addresses in the range.
64
65 • Does less
66
67 This distro does not support every method provided by NetAddr::IP.
68 Patches to add more features are welcome, however.
69
71 Please report any bugs or feature requests to
72 "bug-net-works@rt.cpan.org", or through the web interface at
73 <http://rt.cpan.org>. I will be notified, and then you'll
74 automatically be notified of progress on your bug as I make changes.
75
77 • Dave Rolsky <autarch@urth.org>
78
79 • Greg Oschwald <oschwald@cpan.org>
80
81 • Olaf Alders <oalders@wundercounter.com>
82
84 • Alexander Hartmaier <abraxxa@cpan.org>
85
86 • Dave Rolsky <drolsky@maxmind.com>
87
88 • Greg Oschwald <goschwald@maxmind.com>
89
90 • TJ Mather <tjmather@maxmind.com>
91
92 • William Stevenson <wstevenson@maxmind.com>
93
95 This software is copyright (c) 2016 by MaxMind, Inc.
96
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99
100
101
102perl v5.34.0 2022-01-21 Net::Works(3)