Is there a parser in Perl out there for dhcpd.leases?
Steve van der Burg
steve.vanderburg at LHSC.ON.CA
Wed Nov 3 14:17:55 UTC 2010
>>> "Niall O'Reilly" <Niall.oReilly at ucd.ie> wrote:
> Thanks, Steve.
>
> On 3 Nov 2010, at 12:49, Steve van der Burg wrote:
>
>> I have been using the code that follows for a couple of years now.
>
> It seems to use the same idea as my existing script does.
So what's the issue with yours? Mine is catching all of the leases. This
local $/ = "}\n";
means that this
while (<LF>) {
gets an entire lease container in $_ each time, since the structure of the file is
something {
stuff;
more stuff;
etc;
}
next_thing {
...
}
So even though a recursive, grammar-based parser isn't being used, some high-level parsing is going on. That is, the while loop is breaking the file into chunks that can then be operated on reliably with regexes.
...Steve
--------------------------------------------------------------------------------
This information is directed in confidence solely to the person named above and may contain confidential and/or privileged material. This information may not otherwise be distributed, copied or disclosed. If you have received this e-mail in error, please notify the sender immediately via a return e-mail and destroy original message. Thank you for your cooperation.
More information about the dhcp-users
mailing list