Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Just curious. The title says it all: Why is Perl installed by default with most Linux distributions?

share|improve this question

4 Answers 4

up vote 14 down vote accepted

The answer is/isn't sexy, depending on your point of view.

Perl is very useful. Lots of the system utilities are written in or depend on perl. Most systems won't operate properly if Perl is uninstalled.

A few years ago FreeBSD went through a lot of effort to remove Perl as a dependency for the base system. It wasn't an easy task.

share|improve this answer
    
Is Perl used in the Kernel itself? I'm looking at this article that claims that the Kernel uses about 2,200 lines of Perl code Estimating GNU Linux's Size. Also, what prompted the question; while installing Arch Linux, I noticed that Perl is installed in the base package, are there core utilities that use Perl? –  user23312 Sep 13 '12 at 2:45
8  
@JoshVoigts the kernel itself does not use perl no. However the process of building the kernel does use a fair amount of perl. As for Arch, someone else will have to answer that one. –  Patrick Sep 13 '12 at 3:50
1  
Out of curiosity, what did FreeBSD replace Perl with? –  Shadur Sep 13 '12 at 4:18
3  
@ire_and_curses: Perl5 is leaving the base system for 5.0 and after! Also as of 2011: FreeBSD: Package Systems Merging (Under OpenBSD). –  bahamat Sep 13 '12 at 5:59
4  
The FreeBSD base system is basically one giant source-code repo with the kernel, utilities, and everything. So they were maintaining their own fork of Perl in that repo, which was a big effort and hard to keep up-to-date with the upstream Perl. So it made sense for them to eliminate Perl from the base system and just install it as a port, which is much easier to keep up-to-date (because they're just fetching the upstream Perl releases and compiling them). –  cjm Sep 13 '12 at 7:56

I think the answer to this question is in part historic, in part practical.

As for the history, Perl is a classy language. It is more classy than Python (not to mention PHP), although I have no idea what is "better" (if that could somehow be formally analyzed, which I doubt). And the classy guys who are using (or used) Perl are typically the guys deciding what should be part of a Linux distro.

As for what is practical, Perl is still the glue of a lot of things: OSs and the web alike (again, LAMP, not forgetting either Python or PHP). So why not include anything that is useful for a lot of purposes? And even more so, why remove anything that is there (and doesn't cause any harm), and is useful?

But, as it happens, there is a note on this in the most recent issue of The Linux Magazine (#151, June 2013). Apparently, in order to compile the Linux kernel a couple of short and simple Perl scripts are employed. (Again, the "glue" role of Perl in OSs.) Now, one of the kernel developers has been submitting patches of a re-write of those scripts, this time not in Perl, but as "Unix shell scripts" (is that sh?). That way, Perl would not have to be installed for anyone compiling the kernel. But, that patch (submitted several times) hasn't been picked up. And one reason for this is, once out in the cold, Perl is not likely to be let in. People like Perl, and they don't want to part with it.

Now, this only touches the fringes of this question as probably a very small minority of Linux users are likely to compile the kernel. But it is yet another piece of the puzzle (and I suspect there are many).

share|improve this answer
    
Not a comment for you, Emanuel, but for people not wanting to part with perl, how hard can it be to just install it if you need/want it? –  MattBianco Sep 25 at 10:16
  1. Perl was developed for Unix because the tools were not powerful enough. For sports, you can look for awk and sed in it (Perl).
  2. Perl was (among other things) inspired by the Unix shell (and C, which is very important to Unix -- or the other way around, perhaps).
  3. Also, Perl can be distributed under a GNU license. Some people would consider that irrelevant from a technical standpoint, but it shows the intermingling.
  4. The last thing I can think of is LAMP, which is a networking "software bundle". (Check it out on Wikipedia: the P is, or at least was, Perl; the L is Linux.) (But this last point is a bit "chicken or egg".)
share|improve this answer
1  
The P in LAMP these days is much more often PHP or Python. I think Perl is moreso a legacy use of the acronym. –  darvids0n Sep 13 '12 at 5:44
    
Notepad++ is released under a GNU license (specifically, the GNU GPL). AFAIK there is little "intermingling" between Notepad++ and various Linux distributions. Just to mention one counterexample to your point #3. –  Michael Kjörling Sep 13 '12 at 12:38
    
@MichaelKjörling: Would you not agree that certain licenses will hinder the spread of your application (or, in this case, a programming language) in the Linux world, while others will not put up such obstacles? That doesn't mean you could license your way into a distribution, if you really thought that was what I said. (I think not.) –  Emanuel Berg Sep 13 '12 at 21:28
    
@darvidsOn: Yes... that's what I said (?). (I guess it is a coincidence that those big scripting languages all start with a P.) –  Emanuel Berg Sep 13 '12 at 21:31
    
@EmanuelBerg You mentioned "intermingling" between Perl and Linux based on the fact that Perl has a GNU license. There is plenty of software in both FreeBSD ports and many Linux distributions that have other licenses, and plenty of software that does not run on either which is licensed under the various GNU licenses (GPL, LGPL, FDL, ...). –  Michael Kjörling Sep 17 '12 at 10:16

In Larry Wall's original Perl v1.0 posting to the comp.sources.misc newsgroup on December 18, 1987, he said:

If you have a problem that would ordinarily use sed or awk or sh, but it exceeds their capabilities or must run a little faster, and you don't want to write the silly thing in C, then perl may be for you.

In a much later exposition, he elaborated a little more:

But the frustrations of Unix shell programming led directly to the creation of Perl, which I don't really have time to tell. But essentially, I found that shell scripting was intrinsically limited by the fact that most of its verbs are not under its control and hence largely inconsistent with each other. And the nouns are impoverished, restricted to strings and files, with who-knows-what typology...

More destructive was the mindset that it was a one-dimensional universe: you either programmed in C or you programmed in shell, because they're obviously at opposite ends of the One True Continuum. Perl came about when I realized that scripting did not always have to viewed as the opposite of programming, but that a single language could be pretty good for both. That opened up a huge ecological niche. Many of you have seen my old clamshell diagram, with the two dimensions of manipulexity and whipuptitude.

Today, Perl is a standard alternative/replacement for shell-scripting and text parsing needs, and with much more power than the traditional tools. Because of it's extreme (some would say inelegant) flexibility, Perl has been described as "the Swiss Army chainsaw of scripting languages". Tasks can often be significantly shorter, easier, or more extensible when solved with Perl. Many, many system tools, scripts and larger programs are routinely written in Perl. So in the modern Linux environment, Perl is now another standard Unix tool, and truly indispensable.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.