Live data from Hacker News

The Perl Renaissance

lanyrd.com

31–40 of 130 posts

Re: The Perl Renaissance

#31

Great talk! I've never posted before, but I'm inspired to today. Forgive me if my code is formatted terribly this post. I used Perl back around 2000, like everybody else, to make CGIs. Then went away from it for a long time. But I've used Perl over the last year to create a large DMCA takedown system, the bulk of which is spidering and analyzing web pages for infringements. Torrent trackers, one-click file download s…

why aren't you using POD for your documentation why are you mistakenly using prototypes for function signatures

You're right on both counts. I would never perldoc my private code...I already don't use it for installed modules. So that's a personal preference. The prototypes issue is spot on. They're ignored during compilation when dispatching isn't clear ($obj->method() ... which subclass?). Most of my subs aren't called that way, so I do get argument checking, which has saved my butt many times, so I just make a habit of always using prototypes. They've been useful for me: that's all I've got there. I could easily be wrong.

And that goes for my whole coding style. You could easily say it's wrong to use "@_" the way I do, which I feel is incredibly convenient. I'm not saying it's a best practice. Maybe it isn't. But for me, it presents no obstacle, and I feel the code is perfectly clear. In in fact, having to enumerate every single argument merely to pass them along, in the same order, to another sub...to me, that seems like a terrible idea. Some people prefer that verbosity (or clarity, if you like). I don't think it's necessary.

Re: The Perl Renaissance

#32
post #17
post #2

...don't get mad for the question, but: anybody has any arguments for using Perl instead of, let's say Python, these days? (besides the "I already know it incredibly well" argument) ...cause the lack of an answer to such a question has only one conclusion: the language is dying, even if this is not already happening in a visible way! (don't get me wrong, I'm not a Perl hater, and fyi, I think the world would be a muc…

That question can be turned around: Why should someone use Python (or Ruby) instead of Perl? For someone who hasn't used any of those, I'd say give each of them a few hours and see which style suits you best. Of course, try to find modern examples to learn from. When it comes to Perl that means: * Mojolicious [1] (or Dancer [2]) as the web framework * DBIx::Class [3] as the ORM (maybe with some sugar [4]) * Moose [5]…

Python and Ruby both have garbage collectors and can deal with reference cycles. Perl only has reference counting, leading to programs that leak memory due to reference cycles and needing to hunt down where in the code you're creating them.

It's the only high-level language I know of that only has reference counting for memory management.

Re: The Perl Renaissance

#33
post #25
post #13

Earlier quoted context omitted.

...don't get mad for the question, but: anybody has any arguments for using Python instead of, let's say Ruby, these days? (besides the "I already know it incredibly well" argument) ...cause the lack of an answer to such a question has only one conclusion: the language is dying, even if this is not already happening in a visible way! (don't get me wrong, I'm not a Python hater, and fyi, I think the world would be a m…

I get the joke, but there are thousands of people currently learning either Ruby or Python and tons of classes for them, it's incredibly easy to hire either a Python or a Ruby (or PHP or Javascript) programmer and so on... while Perl is slowly falling off the radar.

[deleted]

Re: The Perl Renaissance

#34
post #7

Earlier quoted context omitted.

CPAN ~ pypi ~ rubyforge. Ruby allows you to write decent one-liners too, though people don't like to use it this way. the only argument I can extract from this is "Perl has a much nicer syntax for working with regexps", and I agree with this (and I hate it when other languages don't fully embrace regexps and treat them as first class citizens). but that's the thing, not even the "reasons not to use it" are unique to…

work uses pypi every day, and I had to set up a caching proxy because mirrors are frequently unavailable. It was inconceivable coming from CPAN that the major package distribution network for a major language may be down.

OT but I think it's one of the reasons mandrake/mandriva never quite took off. There was never a great centralized repository network you could count no - I grew tired of using the PLF system to grab a list of mirrors, and having to update it all the time because participating mirrors were offline or defunct after a few weeks/months.

Re: The Perl Renaissance

#35
I would recommend starting with MooseX::Declare instead of Moose if you are trying to upgrade your Perl, as Moose is great above standard Perl OO but doesn't go far enough by itself.

Previously I found that MoooseX::Method::Signatures was very slow, so I ended up selecting Method::Signatures::Simple.

Coupled together, you end up code that looks somewhere between Ruby and Java. It's not my first choice for a new project, but it's not a bad way to fixup an old but large codebase.

Possible code example:

https://github.com/mpdehaan/Elevator/

Re: The Perl Renaissance

#36
post #17

Earlier quoted context omitted.

That question can be turned around: Why should someone use Python (or Ruby) instead of Perl? For someone who hasn't used any of those, I'd say give each of them a few hours and see which style suits you best. Of course, try to find modern examples to learn from. When it comes to Perl that means: * Mojolicious [1] (or Dancer [2]) as the web framework * DBIx::Class [3] as the ORM (maybe with some sugar [4]) * Moose [5]…

Python and Ruby both have garbage collectors and can deal with reference cycles. Perl only has reference counting, leading to programs that leak memory due to reference cycles and needing to hunt down where in the code you're creating them. It's the only high-level language I know of that only has reference counting for memory management.

> It's the only high-level language I know of that only has reference counting for memory management.

It's also the only high-level language I know of that can't really be parsed ("only Perl can parse Perl" they say).

It's a dead language really, you can also see this from the number of noisy evangelists vs. professional users nowdays (and that comes from someone who has used Perl almost exclusively for the past 10 years), if you couldn't see it from the diminishing quality of important modules on CPAN (e.g. I pulled my hair today over JSON::XS generating '-inf' from values on one side and crashing on the other side while trying to parse it).

So, I'm learning Go now and improving my JS skills.

Re: The Perl Renaissance

#37
post #5
post #2

...don't get mad for the question, but: anybody has any arguments for using Perl instead of, let's say Python, these days? (besides the "I already know it incredibly well" argument) ...cause the lack of an answer to such a question has only one conclusion: the language is dying, even if this is not already happening in a visible way! (don't get me wrong, I'm not a Perl hater, and fyi, I think the world would be a muc…

Python significant white space. Really, that's what preventing me for ever liking Python.

When programmers discuss Python on the web, this comes up again and again. I agree with you - it is a minus for me in terms of using Python. There are "solutions", there are people who say you get used to it, there are people who say it does not matter, yet it comes up again and again. I guess it does matter, to some of us at least.

I can open up a text editor and start writing C, or Java, or Perl, or PHP - all without that much thought on whitespace, indentation etc. I can later run indent -kr, or perltidy, or astyle and so forth and make the code I banged out look nice and tidy. Sometimes I feel like doing the nice indentation myself while coding, sometimes I do not and let the scripts do it. With Python "there is one way to do it" and you have to think about indentation while coding. It is annoying. It is like Java and exceptions, forcing me to put try/catch loops everywhere and messing up my scope - even for a little prototype program which will be run once and will never need to catch an exception. It is treating me like I am an idiot and forcing me to work in a regimented manner.

When I first learned Python, at one point I decided to put a do/while loop in my program. I was not able to discover how this was done in documentation. I go on IRC #python and am told Python has no do-while loops (which I later confirmed is true). I was told, and I am assuming the source knows more than me, that this is due to the indentation system. One screwy thing done as a result of another screwy thing.

There are a lot of nice things about Python. The code is clean and understandable. It sometimes allows you to do in 2-3 lines what might take 10 lines in another language. And so on. But some programmers feel certain aspects of it are drawbacks, and these things are not easily dismissable. If they were, they would not be brought up again and again.

Re: The Perl Renaissance

#38
post #5

Earlier quoted context omitted.

Python significant white space. Really, that's what preventing me for ever liking Python.

Opinions on Python aside, I'd never hire somebody saying something like that at an interview, even about a language I don't like. You should really look past petty details when evaluating any tech and come up with actual arguments.

Why won't you hire someone who has a unfavorable opinion on a language? Do you feel the same way if he mentioned Java instead of Python?

Re: The Perl Renaissance

#39
post #37
post #5

Earlier quoted context omitted.

Python significant white space. Really, that's what preventing me for ever liking Python.

When programmers discuss Python on the web, this comes up again and again. I agree with you - it is a minus for me in terms of using Python. There are "solutions", there are people who say you get used to it, there are people who say it does not matter, yet it comes up again and again. I guess it does matter, to some of us at least. I can open up a text editor and start writing C, or Java, or Perl, or PHP - all witho…

So technically not "do/while", but:

  while(some_condition):
    do_stuff

Re: The Perl Renaissance

#40
post #11

Earlier quoted context omitted.

Get an editor that shows whitespace. (Non)Problem solved. Not to mention you should indent your code exactly the same way (in a consistent format, either tabs or spaces) with how you'd indented Python code.

It isn't totally solved. For example, you cannot write a lambda that contains a line-break. Its not a big problem, but it is a trade-off.

Put this in a text editor and run it in python:

  print(reduce((lambda x, y:
                x + y), xrange(10)))
  print(reduce((lambda x, y: x + \
                y), xrange(10)))

HINT: It runs.
Post reply on HN