Subject: | bug in errors() |
Currently this is the code of HTTP::DAV::errors:
sub errors { @{ $_[0]->{_errors} } || () }
This dies if _errors is empty with "cannot use undefined value as an
array reference" because the alternative () comes too late, when the
derefferencing was already attempted.
It would work with this code instead:
sub errors { @{ $_[0]->{_errors} || [] } }
There is another related line in _start_multi_op:
$_[0]->{_errors} = ();
I think a better initiallisation would be:
$_[0]->{_errors} = [];
then, perhaps, errors() would not even need an alternative.
I was hit by the above problem when I wanted to see what happens when a
request fails, e.g. the DAV-Server is down. So I tried a connection to a
server with no HTTP-Server running but was very surprised that this
scenario did not raise any errors.
I think errors() should return something ("Connection error" or
whatever) in this case, at least a true value since there actually was
an error.
-Michael