Text::DHCPLeases(3pm)
β¨ Text::DHCPLeases β¨
okay bestie, so this is the Text::DHCPLeases page from the Perl docs β it's a Perl module, and it does exactly one iconic thing: it parses the DHCP leases file from ISC dhcpd. π No cap.
πΈ NAME πΈ
Text::DHCPLeases β parse the DHCP leases file from ISC dhcpd. that's the whole vibe, she's a parser, she's got one job and she ate. π
π¦ SYNOPSIS π¦
use Text::DHCPLeases;
my $leases = Text::DHCPLeases->new("/etc/dhcpd.leases");
foreach my $obj ( $leases->get_objects ){
print $obj->name;
if ( $obj->binding_state eq 'active' ){
...
}
}
...
look at her go π so clean.
π DESCRIPTION π
so basically this module gives you an object-oriented interface to ISC DHCPD leases files. the whole goal is to objectify every single declaration, exactly as they're defined by the ISC dhcpd package man pages. periodt.
and like, why do you care? because this interface is lowkey perfect for analyzing, reporting, converting lease files, or honestly just being the tool that other applications use when they need to import dhcpd lease data structures. she's versatile, she's the moment. π«Ά
π CLASS METHODS π
π new - Class Constructor
the glow-up moment where you make one.
Arguments:
a hash with the following keys:
fileβ the leases file path
Returns:
a Text::DHCPLeases object π¦
Examples:
Text::DHCPLeases->new(file=>"/etc/dhcpd.leases");
π INSTANCE METHODS π
π get_objects - Get objects from leases file
grab your objects, bestie.
Arguments:
object attributes to match (optional β so yes, you can filter, slay)
Returns:
an array of Text::DHCPLeases::Lease objects, or an iterator depending on context. it's giving β¨context-sensitiveβ¨
Examples:
my $it = $leases->get_objects(ip_address=>'192.168.0.1');
while ( my $obj = $it->next ) ...
π§ print - Print all lease objects contents as a formatted string
spill the tea, formatted. π
Arguments:
none. she needs nothing from you.
Returns:
a formatted string β
Examples:
print $leases->print;
π BUGS AND LIMITATIONS π
okay so real talk, this is the part where we're honest. π
correct parsing of leases files depends entirely on changes made to the format of said files by the authors of the ISC DHCPD package. this module was tested against leases files generated by ISC DHCPD version 3.1.0. also, the author doesn't have access to leases files containing every possible declaration and statement, so parsing could be broken in some circumstances. patches are welcome β like genuinely, send them, we love that. π«Ά
no bugs have been reported. (iconic of her tbh)
please report any bugs or feature requests to bug-Text-DHCPleases@rt.cpan.org, or through the web interface at <http://rt.cpan.org>.
π AUTHOR π
Carlos Vicente <cvicente@cpan.org>
π LICENCE AND COPYRIGHT π
Copyright (c) 2012, Carlos Vicente <cvicente@cpan.org>. All rights reserved.
this module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. see perlartistic. π
β οΈ DISCLAIMER OF WARRANTY β οΈ
bestie this part is in ALL CAPS for a reason, don't skip it. π«£
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
and that's the whole page, bestie π«Ά this was perl v5.36.0, dated 2023-01-22, and the page itself is Text::DHCPLeases(3pm). go parse something, you're gonna eat. π
β¨π
π¦ where this page comes from
- debian bookworm: libtext-dhcpleases-perl 1.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-dhcpleases-perl 1.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-dhcpleases-perl 1.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-dhcpleases-perl 1.0-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-dhcpleases-perl 1.0-3 Β· 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