15 ms·
In Praise of Perl 5
- rikacomet 13y agoA few words in appraisal of perl over fcgi?
- rjbond3rd 13y agoPerl works in all the new, and not-so-new, ways.
- kanatohodets 13y agoCheck out http://mojolicio.us/ http://mojolicio.us/ for a more modern take on web dev in Perl -- the most common deployment is a nginx reverse proxy in front of the built-in (non-blocking and preforking) web server -- just like suggested setups in node/python/ruby/etc. One cool bonus that mojo provides is hot deployments, so there's no need to restart the server process to get new code.
- einhverfr 13y agoI run LedgerSMB over fcgi. Plack and Mojolicious are both good frameworks for that (I use Plack). One of the neat things you can actually do in this environment (we do this for old code we inherited from SQL-Ledger due to scoping issues) is preload dependencies, then when a request comes in, fork, execute, and die. This allows you to fairly easily run fcgi-unsafe code in a fcgi environment caching what you can safely cache and disregarding the rest. This can be a big deal for improving performance of legacy cgi code.
- guylhem 13y agoI don't care how un-sexy perl is by current standards. It's damn efficient, even for new projects. Also, it's not hard for a developper worth its salt to get productive in perl. At the moment I'm playing with some threaded perl to parse very large text files - part of the code was developed by a C++/Java/js fan, who just realized it was the best tool for the job, and created that after a few days of playing with perl.
- Pacabel 13y agoBut is that really unique to Perl these days? It may have been true in the mid-1990s, but things have changed since then. Python and Ruby both have a much cleaner syntax, yet still offer very comparable functionality, excellent portability, ample standard and third-party libraries, excellent documentation, supportive communities, great regex support, and basically everything else that Perl offers. Since everything positive about Perl is also offered by alternative languages today, and those alternatives are themselves much better than Perl in some respects, Perl seems like a less and less enticing option each day.
- _delirium 13y agoIt could be familiarity, but for small- to medium-scale "scripts", I still find Perl to be the best alternative to bash+sed+awk+grep thrown in, when I want to go to something more conventionally programming-ish. Basically its original use-case, before Modern Perl. You can use Python for that, but the jump from Unix shell to Python feels bigger; everything is more verbose and less awk-y in Python. Which can be good for maintainability of bigger scripts, but feels heavyweight for some stuff.
- wting 13y agoAre you aware of sh? http://amoffat.github.io/sh/ http://amoffat.github.io/sh/
- codygman 13y agoAnd the Haskell equivalent for a performance and type safety boost: https://github.com/yesodweb/Shelly.hs https://github.com/yesodweb/Shelly.hs
- kamaal 13y agoIts not about having function to call shell commands. That way I might as well use C or C++ or Java. Its about how such a feature interplays with rest of the language. Frankly speaking in Python it looks like added after a lot after thought and a lot of reluctance. Same with regular expressions.
- dionidium 13y ago"These posts are aimed at software engineers more than developers" I don't know what this means
- beat 13y agoThat means you're a developer.
- smacktoward 13y ago"If you have to ask..."
- nfoz 13y agoIn Canada, you have to be an accredited professional to use the word Engineer in your title. This means being a member of a specific association, meeting professional standards in your work and qualifications. This is enforced in part by a trademark on the word "engineer". In the U.S., there is no such requirement. Anyone can "be an engineer". Now that I work in the US, I call myself a software engineer or a software developer or a programmer, as interchangeable terms. If there is an actual distinction here I would really like to know it. I also wonder how much these terms may have different meanings in other countries/regions.
- bunderbunder 13y agoIn the US, these words have different meanings in different companies. At my company (fairly big - Fortune Global 500) I'm pretty sure they have different meanings in different product teams.
- codygman 13y agoI do both of these things though.
- beat 13y agoThat means you're a software engineer.
- beat 13y agoBah. I learned Perl with Perl 4, which was a lovely little regularization of sed, awk, sh, and unix system calls. Absolutely fantastic, loved the heck out of it. Perl 5 is an abomination.
- eieio 13y agoI have 0 familiarity with Perl 4, and some(but not a lot) of familiarity with Perl 5(I have maintained Perl, I don't ever use it for a new project). What makes you call it an abomination? I'm not a big fan of the language, but I have no idea why it'd be worse than Perl 4.
- beat 13y agoThree words, in quotes… "object oriented programming".
- nine_k 13y agoIt was `man perl4` that gave me one of the best fair warnings I ever encountered in a software product: "Generally [these features] work as you'd expect, unless you expect consistency". It helped me enormously in understanding the philosophy behind Perl.
- mmaunder 13y agoI've used Perl extensively inside the BBC, Credit Suisse First Boston and a few other big corps. Also was a dev on a global warehouse management system written in Perl. But saying your startup is using Perl is not going to get you funded or laid anymore (and I miss grunge too) so there's not much love for it in Valley/Incubator circles. These days I'll drop into coding in Perl for the regex syntax and backticks. But the reality is there's not much difference between it and PHP in terms of features. Used to be that it was better than Ruby because of performance and stability but they're about par now. So I don't think there's much point in evangelism or debate about Ruby vs Perl vs PHP or even Java anymore because they all get the job done in pretty much the same way. From a practical PoV I'm more interested in languages that actually do something well that other languages suck at e.g. node. I wrote a FSM/Long Polling web server implementation in Perl using epoll() before Node came along and now I love node more than most (and still wear the scars from a particularly tough hashref autovivification bug).
- eieio 13y ago> and still wear the scars from a particularly tough hashref autovivification bug As an infrequent perl programmer[1], I'm curious about the bug. Googling tells me that perl if($foo->{bar}) will always pass, which is pretty goofy to me. Was it something like that? [1] Well really, a bad perl programmer. I've occasional had to make minor edits to legacy perl. I don't write perl. And, as the mistake in this post shows, that's probably a good thing :)
- Thetawaves 13y agoI don't know why this guy thinks it's a good idea to create his own idioms and language features which inhibit the ability to understand the code by pretty much anybody else.
- BugBrother 13y agoUh, no. That wasn't his own language features, he used Moose in the last example, it is the standard OO environment in Perl. To simplify a little, most new Perl code use Moose. The author did discuss a bit how Perl is extendable, which is where Moose comes from.
- einhverfr 13y agoTo be clear, I am also the author of the PGObject::Util::DBMethod which adds the dbmethod() syntactic sugar used in the third class. One thing to note is that this was done specifically in the way it was so that it would fit in with Moose-like idioms, so it is more a matter of extending the Moo(se) way than it is creating a whole new idiom.
- einhverfr 13y ago> I don't know why this guy thinks it's a good idea to create his own idioms and language features which inhibit the ability to understand the code by pretty much anybody else. First, there are two ways to read that last example: 1. Literally as Perl code: has() and dbmethod() are functions. There is no difference between has id => (is => 'ro', isa => 'Int'); and has(id => (is => 'ro', isa => 'Int')); If that doesn't occur to you, you have no Perl experience ;-). 2. as language extensions: has and dbmethod define new aspects to the class in a declarative way. The thing is, these are both simultaneously true, and that means you can read them as #2 when coding and fall back to #1 when debugging. Since they are simultaneously true, there's no difference between writing new functions and what we do here, except that this allows (and does not require) one to think about the code in additional ways. As a note, exactly what people I know like about working with Lisp on large projects is the mutability and the ability to create very useful and readable idioms for the project.
- nine_k 13y agoPerl, above all, is an incredible cluster of experiments in language design, and a work of art. Despite that, it's also a relatively practical and reasonably popular language (else it would end up among esoteric languages). The very richness, intricate ornamentality, flamboyant conceptual exuberance and non-orthogonality that make it an art object also make it unsiutable [for me] for real development. I like my tools compact and precise.
- kbenson 13y agoInteresting. I like my use of those tools to compact and precise, which is why I value Perl. I find the expressiveness lets me convey the meaning of the code with a minimum of boilerplate.
- perl_uber_alles 13y agoPerl is the best. I take Perl over (Python|Ruby|Php) any day of the week!
- systems 13y agotl;dr here are lines from the article to summarize it "The .. point is that Perl 5 gives you a way to build .. (DSL's) that can be seemlessly worked into a general purpose programming environment." "Perl is a language many people love to hate. Here's an example .. of sloppy coding" "It is very hard to modify safely." "it is possible to do this sort of thing in any language." "Let's try this newer Perl code" "This .. is easier to maintain, and is easier to understand." "The above two examples ..neither one really shows what Perl is capable of doing" "Perl itself is a highly malleable language and .. allows you to define domain-specific languages for parts of your program" "Here's a small class for handling currency records." "Now the code above .. is effectively entirely declarative." "What differentiates the examples .. is .. readability, testability, and maintainability." "How does that work?" "Perl is a very flexible .. you can add functions that behave .. like keywords." "The example here uses two modules which provide DSL's for specific purposes." "The first is Moose" "The second is PGObject::Util:DBmethod" "Why is this Powerful and Productive?" "Compare a framework built as a mini-DSL specification language to one built as an object model." "In an object model framework one .. has to juggle object-oriented design .. with the desire for greater flexibility." "DSL's .. allow you to define the object model orthogonally to the framework" "Other Similarly Powerful Languages" "Lisp" "Rebol and Red,.. implementations are still very immature" "Metaprogramming helps to some extent..in Ruby and Python .. but .. makes it much harder to build a framework that is truly orthogonal to the object model." " Perl isn't just a programming language, but a toolkit for building programming languages inside it. "
- draegtun 13y agoThe full statement from the article was - Rebol and Red, whose open source implementations are still very immature To clarify this… 1) Rebol 2 is a very mature product. But while free to download & use it remains closed source with no long term future. 2) Rebol 3 is an alpha/beta opensource rewrite of Rebol 2. While Rebol 3 isn't has mature as Rebol 2, it is robust and does run about 2 times faster than Rebol 2 and with other significant design & implementation improvements. However it is incomplete and missing some Rebol 2 features. 3) Red could be viewed as "very immature" because the implementation was only started in 2011. However it is looking very promising and I believe the aim is to get to version 1.0 by end of this year.