Catalyst

adventures in webdev with perl

install on windows

NOTE: Yes, I know about CatInABox and no, I don't wanna use it for the same reason I don't wanna talk about FreeBSD ports or Debian packages, namely there wouldn't be much left to say, now would there? No action, no suspense, no justified rage and this page would then be too boring for you to read on.

OK, let's start with the ingredients for the main dish:

  • 1 (one) installed OS. (I used: WinXP Professional SP2)

First off, yes, it has to be made by Microsoft, you smartass, Linux is not part of this topic. WinXP Professional is recommended, but any WinXP or Win2K should work. Pretty please don't try this with DOS, as your head will explode and I will not deal with the resulting mess. Use Win9x or WinMe at your own risk as your head might still explode.

Please note that Perl 5.8 is required by Catalyst. Perl 6 will make your head explode. For now.

  • 1 (one) Internet connection. (I used: 768 Kbit/s ADSL)

A decent bandwidth is recommended. Using some crappy 32 Kbit/s dial-up connection with guaranteed disconnect after 15 minutes won't make your head explode, but it will bore you to death.

Some optional stuff you might wanna have for the sauce (you can do without it, but it's no fun):

  • 1 (one) HTTP webserver. (I have: Apache 2.055)

  • 1 (one) SQL database server. (I have: MySQL 5.0.18)

or

  • 1 (one) standalone SQL app. (I have: SQLite 3.3.4)

Got everything? OK, my goal is to install Task::Catalyst and of course have a fairly complete and tasty install of this framework as a side effect.

The PPM Way

Since I use ActivePerl and it comes with a package manager (called ppm) let's try to use it, but see also the end of the ppm rant for complication related to upgrading packages from different repositories. Inspired by the Catalyst FAQ, I checked out chansen's ppm repository. Turns out this one is pretty stale (9 months old now, Catalyst version 5.23) and thus quite unpalatable for the discerning cook.

What to do? Well, it just so happens that the other ppm repository mentioned there Theoryx5 there has the current version of Catalyst (5.65) so I will use that, adding the other repositort mentioned as a kind of fallback (though I don't think it's really necessary):

rep add Theoryx5 http://theoryx5.uwinnipeg.ca/ppms/ rep add Catalyst http://home.ngmedia.net/chansen/catalyst/ppms/ install Task::Catalyst

So, here we go, and the first to be installed is ... YAML! 0.35? WTF? There is major fuckup-ing going on here. First, it turns out the Task::Catalyst PPM is pretty outdated (1.50 vs. 1.70 current version) and second, ppm seems to install an ancient version of YAML. Meanwhile PPM is chugging on, the little package engine that could, installing like there's no tomorrow, there goes DBIx::Class and it's version 0.03003 (another out-of-date PPM, current version is 0.05007), blah, blah, confirm some Template-Toolkit install stuff (fetch me this and fetch me that), until, suddenly:

BOOM

Error: Failed to download URL http://home.ngmedia.net/chansen/catalyst/ppms/Catalyst-Plugin-I18N.ppd: 404 Not Found

Looks like some dependencies don't even have a ppm provided. So how far did I manage to get along? There are 73 packages installed. I started out with 3 I think (ActivePerl-* and ActiveState-*) so that would make it 70 packages installed before crash (not sure about that). Catalyst is installed, along with DBIx::Class (and DBIC::Loader) and the required Model, Template-Toolkit for views, as well as Catalyst Session (no store) and Authentication (with DBIC store only) Plugins. I take it that Sessions aren't really usable (there's no storing backend) and therefore neither is Authentication (no Session to tie it to).

So let's say the install so far is usable but still lacking. What are my options now? I can go to CPAN-based install (but there's no uninstall for that) or I can try to roll my own ppm packages from a fresh source tree of Catalyst. The latter it is then, the action and thrill of building my own packages like every true japh should do.

Fetch ye yonder Source Tree

So, let's add to that list of ingredients:

It's the latest in Catalyst technology and therefore some things might explode in your face. In this case seek help either on IRC or on the mailing list while praying fervently to the God of Code Compatibility and Feature Integration, thusly: "Oh, dear Lord, please let this code work with the rest of the stuff, forgive us our sloppy refactoring and lead us not into framework migrations, but deliver us from incompatible API changes, amen".

How did I get the source tree? Well, using TortoiseSVN and the aforementioned URL. Just like that.

The Building of Packages

Most perl modules are built using one of the three main build systems: ExtUtils::MakeMaker, Module::Build and Module::Install. The first one needs a make utility. The second one comes with it's own build script, while the last one resorts to make again. Make in this case would probably mean nmake of which there are many versions (mine is the one that comes with Visual C++ 2005 Express Edition, but the PPM FAQ has a link to an earlier one). A little help comes in the form of PPM::Make will provide you with two scripts, make_ppm for creating a package and ppm_install for creating and installing the package (you still need nmake for packages which are not based on Module::Build). So here we go, the last step is to install PPM::Make from ppm:

install PPM-Make

So, where were we? Aha, Catalyst::Plugin::I18N. Well, I just went into its source directory (among the ones checked out fromSVN) and ran ppm_install, and a couple of dependencies later BAM, the infamous I18N plugin was quickly packaged and installed.

After that I started the Task::Catalyst install again (though it nagged me that I was actually installing version 1.5 while the fresh source of version 1.7 was already on my hard disk), and everything went smoothly for a while until, yes, you guessed right, another missing package, Catalyst::Plugin::Authentication::Store::Htpasswd this time.

No problem, I tought, ppm_install to the rescue! But this one was sneaky, it actually depended on another module which was also not available except as source. So I had to install Authen::Htpasswd with ppm_install first, the the corresponding plugin.

Back to Task::Catalyst and thar she blowed: Catalyst::Plugin::HTML::Widget, also depending on HTML::Widget which had no ppm, but this time, the sneaky Module::Build offered to install the missing module via CPAN. Oh no, you don't, amigo! I will do this the ppm way, because I promised to. HTML::Widget also had a number of missing dependencies, which I managed to find with ppm and soon we were back in business having ppm_install-ed both HTML::Widget and its Catalyst::Plugin.

Next stop, HTML::Prototype! This time the META.yml was b0rked, but a couple of judiciously placed "-" solved this problem too. Then we stumbled upon Catalyst::Plugin::Authorization::ACL, but this one was a no-brainer, just like Catalyst::Log::Log4perl, which came right after it and Catalyst::Plugin::StackTrace which was the last missing ppm. All solved with a cd and a ppm_install

And in the end there it was: Task::Catalyst (version 1.5 nonetheless) in all its glory on Windows. What a beautiful sight to behold!

It was just time to move on to...

The Moral

Is there is anything to learn from this? Well, I learned this:

  • make good use of the tools: both ppm and PPM::Make will help you considerably getting the damn thing installed, (while CPAN seems to be a favorite, portable and able to install anything, ppm usually does it's job on windows better than CPAN)
  • have a plan B ready even if it's down and dirty: for ppm, the plan B is PPM::Make, if that doesn't work a compiler and a make utility might do the trick
  • expect trouble when installing large systems: while the occasional module installs fine, with a framework with as many dependencies and plugins as Catalyst, you're just bound to run into problems, some features make use of exotic modules, other plugin modules are out of date or no longer maintained
  • usually you can get help if nothing works anymore: the mailing list and IRC channel are pretty helpful