Just a couple of small suggestions. Set the host to lower case as it should be matched case insensitively. Also, using an equals operator like == or eq would (eventually) do a string comparison. A bitwise comparison with IP::addr will be more efficient and support CIDR.