News for hackers. Stuff that matters.
Re:Perl: Love it, or hate it, but don't ignore it by jrockway on Friday November 27, 2009 @05:42AM (#963706)
This thread gives me serious deja vu. It seems like every time someone says they like Perl, the exact same arguments usually show up in duplicate. Someone posts Yegge's "I hate Perl" article. Three or four clever souls post something like, "I ditched Perl 100 years ago and never looked back". Then chromatic comes along and says something not-negative about Perl, and someone else asks him for conclusive proof.

Anyway, I can't find words intense enough to describe how I am feeling right now, but it seriously disturbs me. It feels like the Universe is recursing on itself, and I am in two of the Universes at the same time. I had to check the date on the comment three times before I believed that it was real. Then I had to do some tests to make sure I was not dreaming. I can't breathe under water right now, so I figure I must be awake. But I can't believe it. This. Again.

Re:Perl: Love it, or hate it, but don't ignore it by paulbaumgart on Friday November 27, 2009 @05:54AM (#963713)
I agree that a lot of Perl bashing is thoughtless. And ideology when it comes to programming languages is just stupid.

I'm sure there are plenty of cases where Perl is the best tool for the job. I know it's very good for large quantities of string parsing, for one.

You seem to know a thing or three about Perl- do you have advice on other cases where it's the best tool to use? I think that might be the most effective form of countering the arguments you dislike, and it would be very practically useful too.

Re:Perl: Love it, or hate it, but don't ignore it by jrockway on Friday November 27, 2009 @06:37AM (#963752)
I think I have too much to say about this for a HN comment, but I will try to condense.

Perl is okay for parsers; but I think other languages have better parsing libraries and other languages run faster. I tend to prefer Haskell these days. It runs quickly, it has good libraries, and it's easy to get it right. (Most of the stuff I have been paid to write is Perl, though. It does get the job done, and it's certainly easier to get right than C or C++.)

Where I think Perl is really really great, though, is for building large applications. Applications are often a lot of pieces that need to be glued together, and this is were being a "glue language" really shines. The "language", of course, is CPAN. There is a library that gives you a good abstraction over almost any task you would ever need to perform.

If you are writing a large application, you don't want to have to implement boring things like HTTP header parsers or HTML templating engines. You want to write your application. Perl lets you do this to whatever extent you like; you can have libraries that make all the choices for you, or you can write everything yourself. (Most people choose some combination of this.) The language itself is fine for this, and the libraries support it. (One time, I wrote a web application without a web framework -- but I used many parts of other web frameworks from the CPAN. So even though I was writing something fairly obvious from scratch; I could still use libraries for the parts I didn't really care about doing My Way.)

I know people are going to say, "well, my language has a library for xxx", but they are kind of missing the point. CPAN has really good libraries for popular tasks, and At Least Has Something for relatively unpopular tasks. But it also has libraries for things other than "tasks"; you can change Perl itself with libraries, and there are libraries for very small programming problems. (Things that you probably wouldn't think you need a library for, like finding the largest element of a list.)

It is just hard to explain this to people that haven't used Perl. They think the only library they will ever need is Ruby on Rails, but there is so much more to library use than huge frameworks.

Anyway...

Perl also makes metaprogramming very easy. This means I can quickly implement some abstraction that's higher-level than "raw Perl", and then implement my application in terms of that abstraction. This makes the application code easier to read and understand, and it makes the application easier to write. As I hinted at above, there are a lot of libraries for this; so metaprogramming isn't some magical thing that only wizards can do -- it's something accessible to every user of the language that can imagine an abstraction.

My blog is currently dead (due to my general disinterest in system administration)... but I wrote a long article a few weeks ago about the sorts of abstractions that the Moose object system lets you build. If you care to read it, I think it's still on the planet.perl.org main page. Search for my name :)

Re:Perl: Love it, or hate it, but don't ignore it by yogione on Friday November 27, 2009 @11:00PM (#964785)
I love CGI, DBI. I can write my own SQL. I don't need an ORM. What modules do you suggest for developing web apps using Perl. Mason or Template Tool kit or something else.
Re:Perl: Love it, or hate it, but don't ignore it by berntb on Friday November 27, 2009 @01:09PM (#964175)
I have to vote this blog post up so I have a reference back. :-)
Re:Perl: Love it, or hate it, but don't ignore it by mock on Friday November 27, 2009 @06:33AM (#963748)
mod_perl2 is really difficult to beat if you need to dig into the guts of Apache. DBIx::Class is a huge win if you need/want an ORM but you've been given a really weird pre-existing DB schema. POE has been around forever, and makes really stable long running daemons that don't have to be babied. CPAN has stupid amount of tools for automating sysadmin tasks, all of which you'll probably end up using once, putting in a cronjob somewhere and forgetting about because it will just work. Any time you need to deal with something old, or weird, or both there's probably a CPAN module for that, you can find it via search, and it probably has tests and docs. Template Toolkit for creating uglyass text is both nice to use and full featured (if you don't want to go down the XSLT hole). I've also found that Perl handles I18N, unicode and uglier things (like shift-jis) fairly well. Almost every payment processor has a module, and they all have a standard(ish) API, so they're mostly interchangeable. Likewise crypto stuff is fairly standardized and pretty complete. In general, if you have to tie something to something else that's weird, Perl is a good bet (because someone has probably done it, put it on CPAN, and documented it).

That's a few of the problems I think it stands out as a great tool for.

Re:Perl: Love it, or hate it, but don't ignore it by mst on Friday November 27, 2009 @07:56AM (#963815)
mod_perl2 is a brilliant tool for writing apache modules.

Catalyst is a far better web framework. So's HTTP::Engine.

And with the PSGI standard and Plack reference implementation, the lighter weight stuff is starting to standardise too - my new toy, Web::Simple, leverages Plack to provide Catalyst::Engine-like functionality but in a very lightweight manner and very shareable between different frameworks with different philosophies.

I remember showing DBIx::Class to Simon Willison at a LugRadio Live - he looked at some of the complex queries chained resultsets and easily build and his jaw dropped. We were going to try and get round to me helping him fix Django's ORM to have more of the capabilities of DBIx::Class in return for him helping me build a django-admin-interface-like piece of code for Catalyst but we never quite got to it, sadly. Happily, our respective communities seem to have already done similar things without us :)

Re:Perl: Love it, or hate it, but don't ignore it by mock on Friday November 27, 2009 @08:15AM (#963840)
I Absolutely agree with regards to web frameworks. But there's a time and a place for apache modules, and mod_perl is definitely the tool for that job.
Re:Perl: Love it, or hate it, but don't ignore it by mst on Friday November 27, 2009 @08:02AM (#963820)
My general rule of thumb is:

Perl5+MooseX::Declare+lots of CPAN for general purpose programming (web apps, network daemons, automation code)

Old school scripting style Perl5 for when shell gets clumsy

Shell for simple scripting

C for bit twiddling either due to hardware level madness or for performance

whichever lisp REPL I have handy for reasoning about high level logic

I don't write GUI apps so I have absolutely no idea what I'd use for that if I did. Probably ObjC on OS X and Perl5 for cross platform (easier to learn Wxperl than to do without CPAN when I'm not aiming for mac-quality polish, I suspect, though that could easily be familiarity bias on my part).

And ... that doesn't really say what Perl5 is best for - it says what I choose to use it for - my general purpose mid range programming language in one configuration, and my primary scripting tool in another.

I actually quite like python (and I hear wonderful things about their wx libs so I'd definitely look before starting on a GUI app) but I like being able to extend my language up towards the problem lisp-style and it doesn't want to let me do that to the same extent as Perl5.

I don't mind ruby but their decision to inflict the single-inheritance smalltalk object model on me rather than the more flexible approached both Perl5 and python allow leads me to discount it for any project where I know I'm going to be heavily object oriented - if I wanted bondage and discipline in my OO I'd be looking at statically typed languages instead.

I'm not sure any of the above really answers your question, but hopefully it explains to you why I don't have a better answer at least :)

Re:Perl: Love it, or hate it, but don't ignore it by mechanical_fish on Friday November 27, 2009 @12:38PM (#964145)
Your life moves forward one second at a time. And if a project is part of your life -- if you visit it every day, and follow it closely -- it also moves one second at a time.

But to the general public, the apparent flow of project time is defined by its managers. Time is measured in milestones. Major book releases. Major new adopters of the project. Major upgrades. If you want time to move forward, you need to clearly define and communicate your milestones, to give the community something to rally around and synchronize on, to provide news hooks and talking points and historical points of reference. If your project has fuzzy milestones, it will feel stuck in time.

It's storytelling. People don't want stories to move in real time. They want plot points. Time moves nonlinearly in a story. Nobody has the time to actually live through every single minute of somebody else's life.

This is why companies issue press releases, novelists and filmmakers put out sequels (a sequel helps sell more copies of the original), and software publishers keep releasing upgrades (each upgrade bumps up sales, if only because it gives news agencies and potential customers a reason to check out the product again.)

If Perl feels like it's stuck in time, it's because the community stopped time nearly a decade ago. They blocked future major releases of Perl 5 by assigning the name "Perl 6" to something else, a move that makes the invention of New Coke look like marketing genius, and which perhaps explains why -- although Perl 5 is said to "be much better than it was five years ago" -- none of the featured books on books.perl.org are much less than five years old, and many of them are nine or ten. New ideas are sold by new books, and new books are sold by version upgrades. Just ask the Pragmatic Programmers, who will presumably come out with the fourth edition of Agile Web Development with Rails in five years when Rails 3 ships. If Rails 3 doesn't ship, nobody will bother to revise the books, because the revisions won't sell well -- not as well as they will when they are coordinated with the news push around Rails 3.

Anywa, back to Perl. Perl 6 was announced in 2000. Then it didn't ship. Then it didn't ship some more. And now it looks as if the whole idea of shipping Perl 6 on a specific date is being deprecated:

http://darkeside.blogspot.com/2009/08/perl-6-gets-release-da...

Big news from the current Perl conference YAPC Europe 2009 here in Lisbon is that Rakudo (star) will be released in spring 2010. Rakudo is Perl 6 on Parrot, which is an equivalent to the JVM or CLI.

Is that an official Perl 6 release? Well, it is the nearest to official that you will see. The Perl 6 team are keen to point out that there will be no such thing as a official version, just different implementations

So perhaps Perl 6 will never officially begin, just as the Perl 5 described by the Camel Book (last revised nine years ago) will never officially end. And so I fear it will be deja vu all over again.

Re:Perl: Love it, or hate it, but don't ignore it by berntb on Friday November 27, 2009 @01:06PM (#964174)
>>If Perl feels like it's stuck in time, it's because the community stopped time nearly a decade ago.

Uh... jrockway, chromatic mst etc have listed cool new developments over just the last few years.

Are you doing language wars, or can you motivate why all that is wrong?

>>looks as if the whole idea of shipping Perl 6 on a specific date is being deprecated

What you quote says (afaik) -- Perl6 has a specification, so there will be multiple implementations. None will be the "official" one. That is a feature.

I'm sorry, but you seem to not know what you're talking about? Have I been trolled?

Edit: "A decade"? That was even before testing took over the Perl world, iirc... Damn, I must have been trolled. (Fixed simple grammar, made a sentence clearer.)