Back during my training, I used to do practically all of my coding in Perl. I loved it.
Then I stumbled upon Python and Ruby, and I did not look back for a long time. When I did, I realized how much I disliked Perl's type system (or lack thereof). I sort of drifted around for a while between Python, Ruby, and Lua (although I do not really like Lua as a stand-alone scripting language, it totally rocks as an embedded scripting/extension language).
About 15 months ago, I started working as a sysadmin at a smallish (~100 people) engineering company, and I re-discovered Perl. I am not sure I would like to implement any largish piece of software in Perl, but as a scripting language for system administration, it still rules. Especially on Windows, which still feels like a downright hostile environment for programming.
Yeah, learning Moose has been on my todo-list for a while now. Back when I still used Perl almost exclusively, I hardly did any object-oriented programming in it, and when I did, it felt awkward.
Moose looks like a game changer, both for OOP in Perl and for typing. Right now, I have a lot on my plate, but once my schedule clears up a little, I will look into it. Thanks for the hint!
(For sysadmin-scripting, non-OOP Perl is entirely sufficient, though.)
You should also check out Moo[2] and Mouse[1]. They both try to be simpler versions of Moose without the compile-time (and runtime) performance issues of Moose. They do that by dropping some things like metaobject protocols and other things that are great for introspection but may not be something you really care too much about. They both try hard to keep syntactically the same as Moose when possible so that you can most of the time use them all interchangeably.
Additionally, Moops[1] may be useful to get some extra sugar going. It's a meta module that includes a few other modules to give you a sane (Moose/Moo) object model, plus function and method signatures through Method::Signatures.
For example:
use Moops;
role NamedThing {
has name => (is => "ro", isa => Str);
}
class Person with NamedThing;
class Company with NamedThing;
class Employee extends Person {
has job_title => (is => "rwp", isa => Str);
has employer => (is => "rwp", isa => InstanceOf["Company"]);
method change_job ( Object $employer, Str $title ) {
$self->_set_job_title($title);
$self->_set_employer($employer);
}
method promote ( Str $title ) {
$self->_set_job_title($title);
}
}
About 15 months ago, I started working as a sysadmin at a smallish (~100 people) engineering company, and I re-discovered Perl. I am not sure I would like to implement any largish piece of software in Perl, but as a scripting language for system administration, it still rules. Especially on Windows, which still feels like a downright hostile environment for programming.