- Perl and CPAN are tightly integrated, whereas NPM and JavaScript are not. Perl without CPAN is unthinkable; JavaScript without NPM is rather pleasant. A huge amount of JavaScript culture, best practices, and idioms existed before NPM and therefore there’s much less cultural cohesiveness on “standard” third party libraries, etc. It’s a different story with Node specifically but the horse already left the barn by then.
- many of the “batteries included” in Python are from a rich standard library that JavaScript/Node lacks. So there isn’t a need for a third party library to implement extremely basic functions like you see in Lodash or leftpad, and for pip packages there’s a much deeper base of code/API standards to draw standards and idioms from.
Once people stop feeling the need to reach for third-party packages to accomplish day-to-day tasks maybe there'll be more freedom to move away from the way npm is the way it is today.
That's already happening. More and more of lodash/underscore/etc's functions are being introduced to Array/Object/String APIs.
https://github.com/you-dont-need/You-Dont-Need-Lodash-Unders...
I've been a CPAN author for over 20 years. They're actually not integrated. I guess I'd use the word cooperative.
The "cpan" utility is used to install them locally, but you don't have to run that command.
Having said that, PHP took over web development because ISPs didn't want to run cpan for end-users on shared hosting, and the PHP standard library had 3000 APIs built-in.
> Perl without CPAN is unthinkable
CPAN has 194,000 modules, but you can live without them just fine. (CGI.pm was taken out of core for some shortsighted reason, so you will likely need CPAN for that now.)
But this thread is about JS and npm, so what can we learn from CPAN?
- an effort was made back in the day to limit the size of CPAN to a single CD, but that obviously failed
- most CPAN modules have no or a few dependencies, so most programmers are comfortable installing and using them
- the Catalyst web framework has an insane number of dependencies, like a 1-hour download at 100 Mbps, and for that reason I don't recommend it
- I don't think it's allowed to delete a CPAN module, so we don't have rage-induced outages like leftpad
I should clarify that I was speaking informally in terms of the culture, not in terms of technology or formal infrastructure. Likewise with "Perl without CPAN is unthinkable" - I didn't mean it was impossible to be productive in Perl without CPAN so much as it's hard to envision Perl as a technology without it.
My overall point is that CPAN is nearly as old as Perl itself, and almost everyone who has ever written in Perl has used it extensively. This is very different from JavaScript, which was one of the world's most popular languages years before Node.js. I think this (along with general 21st century trends) is a major reason why NPM is so much of a disaster compared to CPAN.