Bug 24538: Handle Net::Netmask parser errors
authorDavid Cook <dcook@prosentient.com.au>
Wed, 19 Feb 2020 02:07:30 +0000 (02:07 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 20 Feb 2020 08:40:52 +0000 (08:40 +0000)
commit87c14e07d65e988a07529a3fd45eae354b1285ba
tree8362c8367e5ea68510913d7b6e6fd8a111f761e2
parentb0d777b8366239523639ffe60735944503434daa
Bug 24538: Handle Net::Netmask parser errors

This patch switches from the new() to new2() constructor,
which will return an undef value when it fails to parse a value.

This patch warns on parser failures, but otherwise silently drops
the invalid value, and returns objects for any valid input it can parse.
This way one mistake won't disable the whole feature.

To test:
1. Run the unit test t/Koha/Middlware/RealIP.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Middleware/RealIP.pm