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/
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?" :)
> 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!
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. :)
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/