CC: | 14232855 [...] ticket.noris.net |
Subject: | on_error handler broken when file is not accessible |
First of all, thank you very much for this fine module which was already very useful to me in several projects!
There is only one small annoyance regarding the on_error handler: Since it is initialized not until after trying to open the zone file, it does not work when opening the file fails. E.g. …
$ perl -MNet::DNS::ZoneFile::Fast -E Net::DNS::ZoneFile::Fast::parse( file => shift, on_error => sub { say "on_error called: @_" }, soft_errors => 1, zone => "example.org" ); say "OK"' /etc/passwd
on_error called: 1 syntax error
OK
… works as expected, but …
$ perl -MNet::DNS::ZoneFile::Fast -E 'Net::DNS::ZoneFile::Fast::parse( file => shift, on_error => sub { say "on_error called: @_" }, soft_errors => 1, zone => "example.org" ); say "OK"' /etc/shadow
cannot open /etc/shadow: Permission denied, line 0
… does not: The on_error handler does not get called, and the script dies though soft_errors is set.
Please let me know if you are interested in a patch for this issue.
Regards,
fany