Text::DHCPLeases(3pm)

πŸ“¦
version 1.0 Β· 2 versions
  • 1.0 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.0 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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 ) ...

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>


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