Net::Works(3pm)
๐ Net::Works ๐
okay bestie, gather round, because we're talking about Net::Works โ the Perl module situation for IP addresses and networks, and it's giving sane APIs โจ (that's literally the whole name, we're starting strong).
This is the page for Net::Works(3pm), which lives in the User Contributed Perl Documentation corner of your system, and no cap, it's a good one.
๐ธ VERSION ๐ธ
version 0.22 ๐
โจ DESCRIPTION โจ
so. The NetAddr::IP module? Bestie, it's very complete. It's correct. It's genuinely useful. We're not hating. ๐ But its API design is a bitโฆ crufty. Like, technically fine but the vibes are off.
This distro provides an alternative API that aims to address the biggest problems with that module's API, plus it adds some additional features. So it's the same energy but with a glow-up ๐ .
This distro contains two modules:
Net::Works::AddressNet::Works::Network
โ ๏ธ NOTE: This distro's APIs are still in flux. Use at your own risk. She's still figuring herself out, okay? ๐ญ
๐ฅ Net::Works VERSUS NetAddr::IP ๐ฅ
here are some of the key differences between the two distributions, bestie, and honestly? iconic behavior:
- Separation of address from network
Net::Works provides two classes โ one for single IP addresses and one for networks (and subnets). With NetAddr::IP a single address is represented as a /32 or /128 subnet. That is technically correct but it can make the API harder to use. Whenever you want a single IP you're always stuck checking that the object you're working with is the size of a single address subnet. Exhausting fr fr ๐ฎโ๐จ
- Multiple constructors
Net::Works lets you construct an IP address from a string (192.0.2.1) or an integer (3221225985) using separate constructors. Pick your fighter ๐
- Next & previous IP
You can get the next and previous address from a Net::Works::Address object, regardless of whether or not that address is in the same subnet. She does not care about subnet boundaries, she simply moves. ๐
- Constructors throw exceptions
If you pass bad data to a constructor you'll get an exception. No silent weirdness, no mystery. Just consequences. ๐
- Sane iterator and first/last
The iterator provided by Net::Works::Network has no confusing special cases. It always returns all the addresses in a network, including the network and broadcast addresses. Similarly, the "$network->first()" and "$network->last()" do not return different results for different sized networks. Consistent queen. ๐
- Split a range into subnets
The Net::Works::Network class provides a "Net::Works::Network->range_as_subnets" method that takes a start and end IP address and splits this into a set of subnets that include all addresses in the range. Chef's kiss ๐ซถ
- Does less
This distro does not support every method provided by NetAddr::IP. Patches to add more features are welcome, however. Underachieving on purpose, but make it open source ๐
๐ฆ BUGS ๐ฆ
Please report any bugs or feature requests to "bug-net-works@rt.cpan.org", or through the web interface at <http://rt.cpan.org>.
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. Look at us, communicating. Growth. ๐
๐ AUTHORS ๐
- Dave Rolsky <autarch@urth.org>
- Greg Oschwald <oschwald@cpan.org>
- Olaf Alders <oalders@wundercounter.com>
๐ CONTRIBUTORS ๐
- Alexander Hartmaier <abraxxa@cpan.org>
- Dave Rolsky <drolsky@maxmind.com>
- Greg Oschwald <goschwald@maxmind.com>
- TJ Mather <tjmather@maxmind.com>
- William Stevenson <wstevenson@maxmind.com>
โญ COPYRIGHT AND LICENSE โญ
This software is copyright (c) 2016 by MaxMind, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page bestie!! ๐โจ this was Net::Works(3pm) from perl v5.32.0, dated 2021-01-09 โ written up all pretty for the User Contributed Perl Documentation section ๐ mwah, go build something with it ๐ซถ๐ธ
๐ฆ where this page comes from
- debian bookworm: libnet-works-perl 0.22-1.1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-works-perl 0.22-1.1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libnet-works-perl 0.22-1.1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-works-perl 0.22-1.1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-works-perl 0.22-1.1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-works-perl 0.22-1.1 ยท 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