Extensibility and Composability

Everyone always says that CPAN is Perl 5's killer feature, and that's true to an extent. Certainly the ability for me, an experienced Perl 5 programmer and CPAN contributor, to discover a need in my code, search CPAN for it, and install the right module within a minute is a powerful reason to write new code in Perl 5.

Certainly the language design of Perl 5 which made CPAN possible is a powerful example to emulate in Perl 6 and other languages.

Certainly the weight of contributions and the ease of publishing new distributions has created a critical mass which encourages new development on the CPAN as well as continued maintenance of existing projects. A loose collection of community standards and a design process which undertakes the barest minimum necessary to index and mirror tens of thousands of modules helps.


Large portions of the CPAN (see also perl5i and why it matters) exist to make up for shortcomings of Perl 5's initial design. This is a normal, natural process. A language designed to solve problems unidentified at the design stage—problems which do not even exist during the design period—will make mistakes, and a language which includes safety valves for this sort of expansion has a stronger ecological potential than one which does not. (Imagine a 4GL which could only output uppercase letters, digits, and a few punctuation symbols to a 3270 terminal. How long will those programs last? (Don't answer that; more screen scraping exists than you would believe.))

No one had the CGI protocol (or FastCGI or WSGI) in mind when redesigning Perl from Perl 4 to Perl 5, and yet Perl 5 (and even Perl 4, if you have an RHEL or Solaris contract) worked very well with that protocol. Now we have Catalyst and Dancer and countless other systems, framework and not, built around a very simple line-oriented control protocol to send documents across the network.

In other words, I want to praise and inspire Perl and the CPAN, not to bury it.

Yet inspiring and improving Perl means assessing its strengths and weaknesses honestly and accurately. One of those weaknesses reveals structural flaws in Perl 5 and exhibits itself in one dramatic fashion through the CPAN: composability of language and abstraction.

I'll explore that idea in specific in the next installments.

Modern Perl: The Book

cover image for Modern Perl: the book

The best Perl Programmers read Modern Perl: The Book.

sponsored by the How to Make a Smoothie guide



About this Entry

This page contains a single entry by chromatic published on November 1, 2010 11:50 AM.

How not to Handle Exceptions was the previous entry in this blog.

Composability, Scoping, and Non-Interference is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by the Perl programming language

what is programming?