cpanpm icon indicating copy to clipboard operation
cpanpm copied to clipboard

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

Open briandfoy opened this issue 2 years ago • 2 comments

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" [email protected] in the RT ticket App.Cpan.patch.txt

briandfoy avatar Dec 07 '22 23:12 briandfoy

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 avatar Dec 08 '22 03:12 briandfoy

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.

briandfoy avatar Dec 08 '22 19:12 briandfoy