... and back to Perl

For the last five years, roughly, I've been doing PHP programming, gradually forgetting the Perl that I knew, except when I wished PHP would do something that Perl makes easy.

One particular syntax I missed on an almost daily basis was:

foo( ) unless $bar;

It was therefore with some trepidation that I started on my new project, which uses Perl, mod_perl, and a heap of CPAN modules that I used to be very familiar with, but have, I thought, forgotten.

I've been very pleased to discover that I haven't forgotten it, although some of it is pretty rusty. Perl's use of different variable sigils ($, @ and % to denote different variable types) was welcomed back like group of old friends of whom you have fond memories, but sometimes confuse their names. If you know what I mean.

But it's all coming back to me, and the various Perl colloquialisms are springing to my fingers.

I think that my years in PHP have benefited me, but I'm not very clear just yet in what way. The ability to jump back and forth between languages can make you perpetually confused, or it can make you stronger in both, depending on your approach. One hopes that you can learn something from the one to take back to the other, but that doesn't always work out.

I am reminded on a regular basis, by support email, that I have a bunch of modules on CPAN which have largely languished while I've been in PHP-land. Of course, many of them have been superseded by better modules while I've been away. The Date ones, in particular, have almost all been superseded by the Perl Datetime project, which, although I helped start, Dave Rolsky has been heading for several years now. Maybe, if I'm lucky, I'll have an opportunity to resurrect some of those modules and start playing with them again. Non-gregorian calendars, and traditions about different dates have long held a fascination for me, and I'd like to play with that again.

But, meanwhile, I'm learning the slang again, and since I've missed a half-dozen releases of Perl, I'm sure that it does even more weird and wonderful things than I did when I was a common face around the Perl circles.

Geek Arrogance and Chauvinism

I read with mounting horror Aaron's post about the Ruby conference, and the various things that he linked to from it. Unfortunately, it's an old and familiar story.

Unfortunately, it reminds me of attitudes in another community I used to be very involved in - Perl. Attitudes within Perl seem to have changed an awful lot in the last 10 years. I'm sure a lot of that had to do with the discovery that Allison Randall was smarter than any half-dozen of the rest of us put together. But, too, it had a lot to do with the examples of folks like Larry Wall and Casey West, who demonstrated by their actions that it was possible to be brilliant, but still be professional. This is a message that many boys (I hesitate to call them men) within the Ruby community haven't grasped yet.

Having been involved in the planning of ApacheCon for the last seven years, I'm also horrified that the planning committee for a (seemingly) respectable conference would accept a talk that made no secret of the fact that it would use jokes about pornography to make its points.

I've written before about how pornography is treated as acceptable for public discourse. That was 6 years ago. At least in the technical circles *I* work in, this attitude has lessened, but not vanished, in that time. It is far less common for me to hear reference to porn in every day technical discussion than it was back then. I don't assume that the people in question believe, as I do, that pornography itself is damaging. I think it has more to do with the realization that some discussions simply don't belong in professional settings. When someone spends good money to travel and attend your conference, they deserve to be treated with professionalism and respect, not treated to a stream of pornographic images and sexual innuendoes.

And this isn't just about alienating the women in your audience. Turns out that some heterosexual men actually believe that objectifying women isn't a good thing. But even if you don't accept that belief, you owe it to your audience to treat them with professional courtesy, and recognize that they are paying a LOT of money to attend a technical conference, not a peep show.

Shame on Matt for putting together this presentation. Double shame on GoGaRuCo for accepting this talk. Shame on the decent men in the audience (assuming there were any) who didn't get up and walk out after the first slide. Shame on the chauvinistic boors who are defending Matt in the various forums where this is being discussed.

Turns out, in the real world, it actually matters if you're a jerk. It's time for the Ruby On Rails community to grow up and realize that being professional isn't a weakness. But it would be grossly short-sighted to merely point the finger at them and not take a close look at the attitudes within our own communities - be they technical or otherwise - and seriously reconsider our common courtesy in the work place.

phptidy

Long, long ago, Steve Hancock gave us PerlTidy, which allowed me to quickly and reliably convert raw Perl code into code that abided by all of my coding standards, whatever they might be for a particular project. This was much goodness.

I even have a vim macro that allows me to select a block of text, type a key sequence, and have that code reformatted so that it is more easily readable, evenly indented, and just prettier.

For many years, I've looked for a similar tool for PHP. I've seen references to something that Coogle did, but I can't actually find it, and it doesn't completely sound like what I'm looking for anyways.

Apparently the problem is that the intermixing of form and function (html and php) that happens in php code, makes this a more difficult problem than just parsing and reassembling source code. I naively think that there must be a simple way to treat HTML as comments and ignore it, but seeing as I have not the vaguest idea of how to go about this, it's kinda of condescending of me to make such claims. What do I know?

This morning I discovered that PerlTidy works, some of the time, to tidy up PHP code. And, of course, sometimes it doesn't, because part of what PerlTidy does is inspect the Perl code itself, in order to determine how to format things, and PHP code doesn't generally parse as valid Perl, except when it does.

When I was learning PHP, I observed repeatedly that it was almost exactly the same as Perl, in most respects, most of the time. This gained me many dirty looks from the "Perl is evil" PHP programmers I encountered, but, since language bigotry has never struck me as a survival strategy, I continue to maintain this belief. Indeed, this belief allowed me to uncover features of PHP that I don't frequently see used, and aren't very well documented, but I discovered blindly by assuming that PHP should behave the same as Perl if I need it to. And most of the time it does.

Ahem. Back to the point.

I find numerous postings on various blogs and mailing lists, where people are bemoaning the lack of a usable PHPTidy tool. I'm really curious why it's a hard problem. I don't understand what's involved in doing this, in the least, either in PHP or Perl, so I have no real notion of whether it is hard or not. What gives?

Conference TShirts

The great conference TShirt is one that, if you have to explain what it means to someone who wasn't there, takes 30 minutes, and leaves both of you feeling like it wasn't worth the effort.

My canonical example of this is the shirt from the first YAPC I attended. It proclaims:

YAPC 19100
Laziness, Impatience, Hubris
Pick Any Three

This has embedded in it at least 5 inside jokes/references. Or 6, depending on how you count.

Most conferences I go to try to make shirts that live up to this level of cleverness.

A good bar is like good software: Open

Trillions and Trillions Served

But I don't think folks often live up to the YAPC shirt.

I was thinking about this while doing laundry and I came across the "hAPI hAPI joy joy" shirt from the Yahoo booth at OSCon.

Perl stuff in svn

For many years, I worked on Perl date/time modules. Calendars - non-Gregorian ones, that is - held a great deal of fascination for me, and I wrote Perl modules for many of them. They're all on CPAN, along with assorted other stuff.

Then, due to a variety of factors, mostly involving Apache, I gradually lost interest in writing Perl calendar modules, and those modules languished. At the same time, the great Perl DateTime module project started (at least in part because of my work, but mostly due to Dave Rolsky) and most of my modules became obsolete, and replaced with the better implementations that came out of that project.

I just rediscovered all my Perl date/time modules in cvs, as I was moving all CVS stuff over to svn. here they are, if anyone cares.

There's some other stuff in there too, if anyone wants to poke around. If you want to submit patches, please feel free to do so. If you want to fork any of these projects and do something else with them, please feel free to do that, too, although I'd kinda like to know about it if they amount to anything useful.

Everything that you can get to in the public/ directory should be considered to be under ASL2 (Apache Software License version 2.0) unless explicitly stated otherwise.

 1 2 Next →



About

Some people are heroes. And some people jot down notes. Sometimes, they're the same person. (The Truth. Terry Pratchett)