Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you haven't played with Perl lately, it's worth looking into Moose, an object system for Perl. It not only offers a much nicer syntax for making objects, but provides features like read-only accessors, roles, introspection, and even types! http://search.cpan.org/dist/Moose/lib/Moose/Manual.pod

I work with Perl professionally now after having spent most of my self-taught programming education using Python, and I've been pleasantly surprised with the language. I'm both coding new projects and working with a more than decade old code base, and I've found that Perl code is as good as the programmer.

Yes, like any decades old language it has its warts, but Perl 5 itself is still being developed and improved upon. For those who know another scripting language, the free book Modern Perl is a great place to start learning: http://modernperlbooks.com/books/modern_perl_2014/



Moose is very clever, but all that cleverness has a cost.

One of the things I like about Perl is that it offers tremendous performance, in addition to having an actually-useful debugger.

Subroutine calls in Perl aren't free; in fact they have a significant performance penalty if overused. And that's exactly what Moose uses, in droves.

Making Perl act like Ruby will also make it as slow as Ruby, and as difficult to debug.


Both Moo and Moose generated inlined versions of their constructors and accessors that mean that there's only a single method call being involved.

As such, runtime is just as fast as any other perl code that uses accessor methods rather than poking into its own internals.

Plus, of course, once you've got a Devel::NYTProf profile showing that a particular accessor is a hot spot, you can still poke into your own internals for that particular purpose to resolve the bottleneck.

So, no, not really; generally you only pay a cost for the pieces of cleverness that you actually use, especially given the existence of Moo for fast-startup code where you don't need the MOP.


Yes, so you can use Moose if you feel that it is necessary, Moo if you want something more lightweight, or nothing if you want speed. Just like there are modules for parameter type checking and all sorts of other nice features. My point is that Perl OO has some alternatives available from within Perl.

I don't know enough to vouch for Perl's performance vs other scripting languages, but I do know my boss (a very experienced Perl hacker) has a favorite saying: "If you wanted performance, why did you pick Perl?" :)


Total time = development time + run time

Perl might be one of the fastest languages from this point of view. I write 1%of my code in C and the rest in Perl for optimal efficiency.


Probably because he's comparing Perl to C.


They are looking to move part of Moose into the core I think. I haven't kept up much lately. They are also optimizing things in the newer versions.


> an object system for Perl. It not only offers a much nicer syntax for making objects, but provides features like read-only accessors, roles, introspection, and even types!

and even metaobject protocol


I've heard a lot of good things about Moose, the Modern Perl effort & so on. Enough that I periodically think about jumping back in the Perl waters. However, I always wonder if it's worth it, because Perl 6 is always "not far from release", so I figure I'll wait to check things out again.

Until the Perl community resolves the issues with Perl 6, the waters are too murky for a lot of otherwise would-be JAPHs.


Don't think of Perl 5 and Perl 6 as being like the Python 2 vs Python 3 situation. Perhaps a better comparison would be that of C vs C++: the latter is inspired by the former, but not everyone who uses the former has any interest (or needs to have any interest) in the latter.

Perl 6 is worth paying attention to, but not as "something which will make Perl 5 obsolete". Don't let the status of the various P6 distributions stop you from using P5 to make cool stuff today. :)


Perl5 and Perl6 are separate languages. Best thing is just to pretend that Perl6 doesn't exist. God knows everybody else does.


Those are separate languages, they shouldn't even have named "Perl 6" with "Perl" in it.


> Moose, the Modern Perl effort & so on.

That's mostly just a marketing ploy by a few people trying to make money off books and speaking fees. Ignore it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: