I'm prepping for an interview this afternoon at what is primarily a Perl shop, and so I'm mainlining the O'Reilly Perl in a Nutshell book as a way of reminding myself about the little details of the language. I can write Perl just fine-- I just made some major hacks to dailystrips for example, and I write various renaming and text processing scripts all the time in Perl, because it is the language for that kind of thing.

But it's little corners like, exactly what does bless do, that I'm reminding myself of. I know it's the OO instance creation operator, and I remember the instantiation procedure but what exactly does it do?

So I go read the source code for Perl, in C, because that's where the magic is kept, and I discover to my not-so-surprise that bless is a complete and utter hack. It puts a flag in the dereferencer to point to a different function, one that seems added after-the-fact, that instead of handling a procedure one way, instead just handles it another way with the recently dereferenced scalar as the first argument. That's all it does. OO is so "bolted onto the side" of Perl that it's amazing how important it seems to have become to the language.

But there's so much missing from Perl; the whole metaprogramming capabilities of modern languages like Python, Ruby, and Javascript is just gone-- done instead with code generation and eval, good grief-- and yet the capacity for obfuscation is so terribly great. In many ways, Perl feels more like Bash scripting with a much bigger library of niceties and bolt-ons, which may explain why I use it that way.