Subject: | documentation and code disagree on semantics of header() |
The code in header() overwrites the full hash on each call:
if (@_) {
if (@_%2 == 0) { # even-sized list, must be hash
%{ $self->{__header} } = @_;
} elsif (ref($_[0]) eq 'HASH') { # First item must be a hash
reference
$self->{__header} = shift;
} else {
croak "Expected even-sized list or hash reference.";
}
}
While the documentation says:
If this method is called multiple times then the values of %args
are additive. So calling "$self->header(-type => "text/html")" and
"$self->header(-foo => "bar")" results in both the content-type
header being set and the "foo" header being set.
I guess the documented behaviour is actually the desired one?