I wanted to write down somewhere public my recent lovely experience using Perl.
I’ve been a paid perl developer for a little over 5 years now. I’d used perl for about 2 years before that. So I’m well into my ‘Intermediate’ stage of Perl. I’ve heard the stories of people writing Web apps in a couple of days and putting them online and making millions … most of them involve Ruby on Rails … and extensive lying about how much “millions” really is.
Last week I wrote a web app that saturday night recorded about $25,000 USD in sales. Here’s the tale…
Some months ago my wife asked me if it was possible to write an application to automate the checkout process for our daughter’s school’s Silent Auction event. I thought about it and said “yes that would be possible”. Obviously this meant I volunteered to do it, but it happened long enough ago that it entirely slipped my mind.
Early last month she came back and asked me how long it would take, and being estimation is never my strong suite I said several weeks if everything went well. In a situation like this, nothing goes well … around this time I started formulating a plan as to how I could make the development time as fast as possible. I knew the app would be a basic shopping cart script and I’d been facinated by Chris Laco’s Handel app for months now. I knew it had been ported to DBIx::Class and had heard lots of stories about how quick DBIC was to develop with … it doesn’t hurt that mst is the most vocal user of Bender on the planet.
So I tested out Handel and after several false starts (note only the current dev release of Handel is ported to DBIC, and it required the SVN version of DBIC at the time). I managed to formulate a plan. But I had no data, and worse no schema. The organizers of the auction quickly got me a schema for the Auction items in the form of an Excel spreadsheet. I attempted to convince SQLT to translate this into a SQLite Database but that didn’t work spectacularly well. It choked on the spreadsheet no matter what I tried. Finally I managed to get a two step process where SQLT built me a schema and a hacked version of Spreadsheet::ParseExcel gave me something SQLite could import.
After that the very useful tutorials from DBIC’s pods and Handel got me boot strapping a rudimentary webapp. I used the SAWA framework because I’ve been working with it for 4 years now, and wanted to experiment with it and Moose, for output I used TT2 because it is the most straight forward Template engine I’ve tried (including XSLT, TAL, HTML::Template, and some custom stuff … note Mason isn’t in here) for Perl Object -> HTML/Text generation.
The day of the event I showed up to the event site early to teach the volunteers who were going to do data entry with me how the application works. This is part one of the secret of my success I knew at the beginning I was only going to have 4 - 5 users max, and I could train them personally. There was almost no training really, when I opened up the first page for the order entry workflow I discovered a bug and couldn’t actually train them on it before they had to leave to get ready for the auction!
Happily the bug turned out to be a simple fix, and once I figured out why it was happening I resolved it and my main workflow was restored. I figured out the odds and ends I needed to with the venue’s network to get the computers printing (required a password), and everybody using the website (hosted on my MacBook, with DynDNS providing a subdomain on prather.org for the evening). I fixed a small issue that some items had never made it into the system (A second excel spreadsheet they’d sent two days before but I’d missed in my email). Once the event started, I basically waited around for my wife to appear and spent the first hour or so walking around until they started closing out items.
The rest of the night was a flurry of data entry, only two items hadn’t made it into the database, and a half dozen bidders had IDs but no record in the database (happily some of the hacks I’d done with Handel were able to accommodate this situation though it was not ideal.) I’ve been told that it has gone better than last year’s manual process … we actually finished order entry in real time with the closing of the data, and were able to proceed to checkout fairly quickly.
Checkout was a bit of a nightmare, we only had one printer, and it wasn’t near the checkout process. But after about 30 minutes we reached the point where all of our time was spent dealing with orders that had gotten confused or needed changes (sometimes data was wrong on the sheets, some times there was keying errors by us …we are only human). All in all everything seemed to go well.
Final tally that night was around $25,000 in auction items, and 7K from a “wall of wine” thing that I’m not entire sure I understand … all raised for the PTO which uses the money to pay French interns to come, stay and work at the school.
So I have first hand accounts that you can write a nice perl commerce app in a week and have it perform admirably under the pressure.