In lib/Net/HTTP/Methods.pm line 528, you can find
die "Missing newline after chunk data: '$line'"
if !defined($line) || $line ne "";
On an transmission error, we got
Use of uninitialized value $line in concatenation (.) or string at Net/HTTP/Methods.pm line 528.
The logic seems incorrect:
die "Missing newline after chunk data: '$line'"
if defined $line && $line ne '';