An ordinary programmer knows about Perl only that the language is dead,
and the code on it is unreadable. But a Perl programmer often does not even know this.
Every beginning rock band should have a Perl programmer,
who would show his cursed unreadable code from the stage
to the low mob instincts, warming it up.
Tribute to stereotypes.
Contrary to stereotypes, Perl still exists. He lives somewhere on the periphery of the consciousness of those who do not write on it. He causes them a strong misunderstanding when they meet those who write on it. The Perl culture is so spread out over time, so imbued with the stability of the language, that it is quite difficult for an outsider to understand what Perl is like today. And how to deal with it.
A myriad of articles on the Internet describe Perl of those times when the sky was green, the grass was blue, and Yeltsin in a drunken stupor pleased the country with fiery dances in front of the cameras, setting the pace for the ravers who danced on that blue grass and under that green sky. And the code from those articles is still compiled. As a result, most programmers have an idea of this language represented by information 10-15 ... and even 20 years ago. One should not lose sight of the inertia of thinking of those who wrote those articles.
Therefore, today I will try to shed light on what happens to the language in its beginning 28th year of life. After all, today Perl has a birthday - he is 27 years old. 20 years of which there is its fifth version. Come in, it will be fun.
')
Is it still in use?
Yes, it is still in use. According to
webtech , Perl is still prevalent in sixth place among web server languages, for some reason losing to ColdFusion, but winning Python. The main thing here is to play a good marketer's card and keep silent about the fact that the total share of Perl is only 0.5%.
And what is generally created and works on Perl? A lot of software, and simple, and complex, and including. used in the web. Perl is, after all, a fairly broad-purpose language and you can find everything on it - starting from desktop programs and servers in telecoms, and ending with disgusting websites. The pearl is Buzzfeed, the site of Komsomolskaya Pravda, a significant part of the site code of the largest registrar of domain names in the CIS Reg.ru, operators of the cold call department of the European department Vodafone choose another victim of intrusive advertising with the help of a program written in Perl ... of course, DuckDuckGo is also worth mentioning as known to many service. Unfortunately, not to mention everything, so much was created in Perl, and the web is just one of its areas of application. The free Perl license has led to the fact that it often gets into the firmware of routers, and God knows what commercial products are also available. It is difficult to say how strong Perl is in bioinformatics, given the strong expansion of python in this area over the past decade, but it is definitely actively used there.
Perl is also a huge amount of glue between tools written in different languages, no, just a monstrous amount of this glue. It is on it that scripts are often written to import new data into old programs in compiled languages, the code of which is no longer to be found. For them, scripts-wrappers and generally graphical interfaces are created, which were not provided for at the time. In 2011, I came across a Perlovik vacancy to support the build system of a large Java project. What can tell us about both the usefulness of Perl and the fact that the Java ecosystem is so overcomplicated that it is sometimes easier to keep a Perl warlock on the staff than two Maven specialists ...
Perl scripts are often written to automate when sh is no longer tolerated, or powershell seems like a dubious option. The number of one-liners that system administrators around the world write to Perl every day, compensating for the imperfection of the tools they use, is simply incalculable. Undoubtedly, Perl makes its important contribution to the development of such an industry as road construction, being an important tool for black ground managers. Consider it to be a bedroom theme.
Looking at vacancies related to web development, and especially those appearing on freelance sites, it may seem as though only grabbers with parsers are being written in Perl. A somewhat more complete picture of what is written by Perl in the field of web development can be obtained
here and
here , and a little
here . But not on the freelance exchange.
Many small projects are written in Perl mainly by enthusiasts. If they had slipped a note to them during a creative fever - believe me, they would have written a draft at the node too. So such projects can not be taken into account. And medium and large projects exist (and are even being created!) In Perl for several reasons, and enthusiasts have nothing to do with it:
- so historically. Year before 2005, Perl did not have an alternative, especially in a niche, when PHP was no longer enough, and Java was already a brute force.
- at a certain complexity, a web project grows to such an extent that it goes beyond a simple request-response. A complex, intricate backend appears, where there can be different caching schemes, content pregeneration, and integration with system tools. And on the back end there are different demons who do it all. And with all the demonization of PHP programmers in other languages, the demons on it you can not write everything and not all. This reason explains why with much better web frameworks, some projects are still written in Perl and Python.
- You have tons of business logic, whose roots go back to the crazy 90s. You tear out pieces of code from an old program on Tk, sculpt them with a REST server, and the perlocode gets a second birth. The beauty of this approach is that, due to the high stability of the language, the changes in the code are usually so minimal that you yourself may think that Perl has already died.
- subspecies of the previous paragraph - Perl is too good a language for prototyping, not only due to the language itself, but also due to a heap of modules in CPAN. Therefore, from a certain point on, the prototype written on it can sigh heavily and creak into the server rack of the nearest data center.
- the customer spent half of the project budget for validol after hearing how much javista would charge for the indicated project. I don't know why, but foreign customers have some kind of incomprehensible reverence for this language, and they are often ready to consider it as an alternative to Java. Not in terms of functionality, which, for obvious reasons, they do not understand, but in terms of reputation.
- in the end, Perl is a full-fledged programming language, in which all the best from other languages are constantly introduced, and which has everything necessary for the implementation of almost any urgent task.
Resuscitation
Perl has long lost its ground in web development, not least under pressure from PHP. The niche was considerable, but the loss to the language that was intentionally created for web development (in any case, the one it was in those days) was quite logical. In the end, Perl was created somewhat for another. But despite this, problems accumulated in the language - non-standard OOP still scared many, web development frameworks objectively lost to competitors in other languages, IDEs simply did not have a comparable level (and now, in principle, no), the cost of Perl programmers is often It was higher than PHP-Schnick at comparable complexity of the projects. Then I myself, I confess, believed that Perl could not adapt and will eventually be superseded from everywhere, and will return to its historical place as a system administration tool.
This situation was until about 2008, although this is my subjective assessment. Then I went to Python. This language could completely replace Perl in the niche of bioinformatics, complex web systems, system programming for unixes (for me, by the way, it was always a mystery why the term “system programming” in the Windows world means intercourse with the kernel and writing drivers, and in the Unix world this usually means all sorts of service scripts). And with that powerful support and enthusiasm that arose around the python, had Cobol in its place, and if Google had gotten it just in time, the result would have been the same. Also, this gossip from Google gave the go-ahead to the use of scripting languages to all fans of languages compiled, who thought until now that touching scripts is beyond their dignity (according to other sources - understanding). And then it turned out that Python solves an important problem from Computer Science, which is formulated as "Even your Mom handles strings better than your compiled language". The importance of this problem is hard to overestimate, and therefore you should not blame those who discovered Python for excessive enthusiasm, and tried in every way to impose it on others.
But ironically, it was Python that gave Perl a chance for development. In addition to Django, there were no full-stack frameworks in python, and Django was so well suited for creating news sites that soon there were more news sites written on it than important news taking place in the world every day. It was then that it turned out that not all sites should be news and written using Django. No sooner said than done. There was a trend for microframes like Flask, Pyrmaid, Bottle.py (forgive me, the pythonmen forgiving such a loose interpretation of the term “microfogram”). Perhaps it was also the case that the popularity of REST services grew, and the python had nothing to do with it, but the microfograms went into circulation.
In Perl, in addition to Catalyst, second-wave frameworks appeared: Mojolicious, Dancer and Jifty. For full stackability, they still did not reach the full-fledged PHP shny Zend or CodeIgniter, but they looked quite decent against the background of the Python microform. And most importantly, it was an indicator that the community still responds to the challenges of our time.
At the same time, part of the community was actively running between Perl, Ruby and Python, dragging features from there. And not only features, but in general style and good practice. At that time, the split of the Perl community into 2 groups was particularly clearly defined - those who want to pull Perl out of this swamp, and those who are used to writing the best tradition of Perl 5 (Perl 5.0 was released in October 1994). And the latter cannot even be blamed - there are quite a lot of system administrators among them, for whom Perl was ideal in the form in which it existed in 1994. Such a bundle is often seen at conferences, where after a report on how someone wrote on Perl convenient The script, which sends him new lots from eBay via SMS, reports on complex infrastructure problems using Corona, message queues, its own CPAN repository and other scary things.
But in general, the situation is improving, and Perl has already overcome the point when a final breakdown in stagnation was possible. The community does recognize their problems and see how to solve them. Of course, there are not enough resources - in one of the YAPC reports last year, there was information that the whole C-shny interpreter code was literally understood by a couple of people, and another 15 could understand their subsystems. There is no need to dramatize these numbers - they do it almost for free, and how many people want to delve into the old C-code, and especially in the intestines of the interpreter of a whole healthy language, when one of the key requirements is not to break compatibility?
Of course, in Perl there will not be such a good IDE as for PHP or Python, because there is not such a large commercial support on the one hand, and there is no simplicity of syntax that would easily allow creating Perl parsers that are needed in every serious IDE. And even if they were, it would take a long time to catch up - in fact, IDEA and Microsoft are monopolists in the IDE market, they set such a standard for the quality of language support that even Eclipse, which has a huge community, is losing ground. Also, since Perl is not a purely web-based language, focusing on web frameworks, which is the case with PHP, is simply not possible. But given the fact that a thick frontend is gaining popularity everywhere, it is not so bad.
As for Perl6, it can either give a second wind to the language or play a cruel joke on it, like the third branch of python, ignored by the community for a long time due to the unwillingness of many authors to rewrite Python libraries for the new version. On the other hand, Perl6 solves an important problem of the fifth branch - finally there is a specification of a language in which anyone can write a compiler, which, firstly, will make life easier for IDE developers, secondly, it allows you to run Perl6 programs on several backends today, including JVM.
Now the outlook for Perl is positive. Don't forget that before Perl both Python and Ruby experienced ups, and as a result, the noise subsided, and the languages firmly occupied the niche in which they really apply. It remains to wait until the same thing happens with Javascript ...
Mythology
Perl will still be considered by outsiders for a long time not from the point of view of the current situation, but from the point of view of myths about it that are walking around the net. As a rule, these myths affect the unreadability of the code, the importance of regular expressions, the obsolescence of the language, CPAN, Perl6, which will obviously be the zero horseman of the apocalypse. And of course the most important is that the tongue is dead.
His Majesty is unreadable
According to those who complained about Perl’s unreadability, there are several main problems:
- Not understanding why you need unless, this if with an inverted condition.
- Misunderstanding of regular expressions. Unfortunately, those who are lazy to figure out exactly how regular expressions work will not be happy with them in any language.
- Double sigils of the form $, @,% in constructions of the form% {$ self -> {'posts'}} or @ $ posts in which complainants see something more than a simple type conversion.
- :
echo "test... test... test..." | perl -e '$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|\`{;;y;-/:-@\-`{-};\`-{/" -;;s;;$_;see'
, , ?
- . , Javadoc — . , , . Perl . , .
- . : , .
, , Perl , . , . Perl . , « ». , - 1990- 2000-? ( Perl) , , AppStore PlayMarket?
Ruby (DSL), . Perl — , , Perl. Ruby DSL, — , , . -, Perl. , , , . , Perl- , - .
, , , 2004 2024 . -.
Perl 3 :
— , - , - .
.
- Javascript — , . Perl ( , ), . — , . . Perl Javascript , . — , , Perl , .
Perl — . Javascript — , . , . Perl (), — , . , , . Perl , 2014 .
— Perl ( , PHP , , ) , , , , . , , .
CPAN
- Perl, , . . Python, Ruby, Javascript, … . , , . . CPAN , . , , 110 000
npm - ? , - Javascript , , . .
http://www.modulecounts.com/. , Perl , , , . -,
CPAN, -, 140 000. ( , , ) 30 000. .. CPAN . , . 2 LWP LWP::Simple — libwww-perl. . . ( , , ), .
Javascript . Go , , , *-dev . Python , , . , , . , , , , — . 2- 3- . Ruby,
. . , CPAN
, . 5 — 194 . .
CPAN . , , , , - .
, Perl- , . 2 «»: -, - , -, Perl . .. ( ) . - , «» 10 200 . «» , , , , CMS( -), . , .
, . oDesk Buzzfeed. . — 15-20$/. 30$/ — . 50$/ oDesk , . . … 2500 $ , . 1500 $, .
, , . - Perl , . , , , , H1-B. .
. , - , Perl .
, . . CMS, ? , , . , , , .
— mail.ru, yandex, reg.ru. , , Perl . - YAPC Perl Workshop , 90% - . reg.ru — , — , , Skype SIP.
, Perl — , , , . .. PHP- RoR- 500$(, !), Perl , - , . , Perl , , — . Perl , .
-
- Perl , . . : Perl -, -, , . , , PHP, Ruby Python .
Mojolicious, Dancer(?) Catalyst — 3 - Perl. Maypole Mason, . , , . — . , , -.
Perl Django, Symfony, RoR. , , Catalyst — , , fullstack MVC- . , ORM, .. Catalyst ORM, , , . , Catalyst. , RoR Symfony.
, — Perl . — , rake Mojolicious. , yui-compressor make-, Perl , - RoR .
Perl. , 3- Symfony , , - . . : , , , .
, PHP, - Perl , , , src. — ORM , — FormFu, -. — Catalyst Mojolicious , , . .
- — . ( ), . , , -, .. SDK, , . Perl , . , — Perl PHP CMS. , , , CMS , -. - , Perl .
Perl — , ( FatFree), , shared-, , , .
Perl 6
Larry Wall . . 2000- . Perl6 , , , .
. .
, 2015 Perl6. , Parrot Perl6 , C# JVM . , MoarVM, Parrot. MoarVM Perl6.
Perl6 Perl5. , , . , , . , Perl5 Perl6. :
https://github.com/niner/Inline-Perl5/. , .
Perl6 — %,@ , , . Perl6 — , .
Perl . , . , .
irc irc.Perl.org, Perl Freenode. , irc , , . , 10 , IRC , Perl 20 . , Open Source IRC.
Perl , , , Perl . , Perl , . — legacy- UNIX-. , Perl, . , . .
Perl . Perl( ) - . Perl- irc.perl.org — . ( ) , Perl 10 , , 10 . CGI. , ! , . ( ) — , , , , .
perlmonks.org. - stackoverflow , . , , -.
Perl - , , . , . , ( — ), . , , . . - , , , , Larry Wall.
Perl?
- , , , , Perl . , , Perl, ftp, , .
sh, Perl. , Perl , , .
, Perl . , . - , . legacy- Perl , .
-, Javascript phantomjs. 2014 HTML . Perl phantomjs.
, Perl, , . Perl, Programming Perl, : Perl, 4- . , Unix, , , . — , , , .
, , , Perl — . if/switch , ..
, Perl , -.
, IDE , Perl — , IDE, .
Perl - ?
. Perl, - :
- ,
- false: "", 0, undef, () , === Javascript PHP
- , , , , , Perl-.
- , .
- CPAN — , Synopsis.
- .
- — , Perl , .
- $_, this Javascript, . $_ this .
- , , , , , , , sleep, printf...
- — .
- PHP , .
- , . , , .
- POD, , . Javadoc.
- , -.
- , .
- Perl . , , .
- , . .
- , Perl
- Legacy Perl , , .
- Java.
- . CPAN . Carton. Makefile. .
- . . .
- . .
- , , .
— Perl , . , , , . - , — , . - , , - .
, . , , .
90-, , . , , . , , . , .
— .