EDIT: To give some more context, the $dist is just another IO::File object, created with tempdir.IO.add("dist.tar.gz"). I've also tried to .open this file and .spurt to the IO::Handle instead of the IO::File, but this returned the same error. Adding :bin to the $dist.open call does also not seem to have an effect.

Are you sure you are receiving what you expected (can't tell from example -- no url)? Is $dist a handle opened to an incorrect encoding for binary data (can't tell from example -- lacking code context)? github.com/sergot/http-useragent/blob/master/t/…
– ugexeJan 17 at 22:51

4

FWIW, getstore('https://cpan.metacpan.org/authors/id/V/VR/VRURG/Perl6/OO-Plugin-v0.0.5.tar.gz', 'OO-Plugin-v0.0.5.tar.gz'); WJFFM. Maybe you should provide a runnable minimal test case so we can see where it goes wrong. And also check which version of HTTP::UserAgent you are using – I used 1.1.46.
– mschaJan 18 at 14:12

Argh, after updating the module (zef upgrade HTTP::UserAgent) it does indeed work. I hadn't thought about trying that, thanks for the tip! Should I close or delete this question, as it seems it's not a relevant question to anyone who updates their packages from time to time?
– TyilJan 20 at 8:13