cpanpm
cpanpm copied to clipboard
RT-145462: cpan -g should use the same download mechanism as CPAN.pm
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
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.
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.