andk / cpanpm

CPAN.pm
87 stars 79 forks source link

RT-145462: cpan -g should use the same download mechanism as CPAN.pm #163

Open briandfoy opened 1 year ago

briandfoy commented 1 year ago

I'm transferring and splitting up some issues reported in App::Cpan many problems, multiple fixes.

The internal _download function uses LWP directly. I need to fix this to use CPAN.pm's mechanism.

Patch provided by "eponymous alias" eponymousalias@yahoo.com in the RT ticket App.Cpan.patch.txt

briandfoy commented 1 year ago

I don't recall exactly why I made the decisions I did, but I recall having a lot of difficulty determining if the facilities that CPAN.pm provided let me know if the operation was successful and where the result ended up.

briandfoy commented 1 year ago

There's another issue that I remember. Whatever downloads things needs to be able to handle https?, ftp, and file schemes. The last is important for MiniCPAN. LWP used to be able to do all of those. HTTP::Tiny, which CPAN::HTTP::Client uses, can't.

And, in general, the separation of concerns in CPAN.pm code is poor. There's not a way to simply grab a file without giving in to all sorts of other machinery. If I want to use the CPAN.pm code to download a file, I have to accept many other things that are a bit onerous to avoid.

File::Fetch might be a good option though. It has only been in core since v5.10, so that pushes out 5.008. It's an improvement though.