Perl on Windows has always been a bit of a problematic case. It doesn't usually come with (C) development tools and users are, on average, rather clueless. Additionally, a lot of Perl code is written on *nix-like systems and many authors aren't aware of the portability pitfalls. Interestingly, the most common problem are path separators, which is reasonably simple to work around if you know File::Spec[1] or Path::Class[2].
I have been doing quite a bit of porting work recently and in the process, I have patched many CPAN modules to work on Windows [3]. Barring downright unportable stuff like Linux::*, the toughest problems stem from modules using signals, fork() or some other form of IPC. For example, it's nigh on impossible to make Test::HTTP::Server::Simple work well on Windows because it needs to kill its forked children. That can make the Perl interpreter dump core on Windows.
But I'm digressing. I wasn't going to write about portability but about something else entirely:
Originally, the I-don't-have-a-C-compiler problem on Windows was somewhat solved by ActiveState with the Perl Package Manager (PPM) which comes with their ActivePerl distribution. They provide a variety of CPAN modules in pre-compiled form which you can install using PPM.
I say "somewhat" because that doesn't really satisfy me. Not that they aren't doing swell work, but it's hard for a single organization to keep up as pointed out by Ovid [4]. This is the reason I jumped at the Strawberry Perl project [5] which goes one step further and delivers a working (and free!) C compiler with the Perl distribution.
Strawberry Perl enables me to use the CPAN shell on Windows just as I do on Linux and it works with 90% of all modules. Notable exceptions are those which require external libraries, of course. We are working on solving this issue, but it's not pretty. Until then, it might be tempting to want to use ActiveState's PPM tool to install those problematic modules, but it turns out there is only a very old version of it available outside their Perl distribution. The nice GUI which they introduced in PPM4 isn't available outside ActivePerl at all. It's a valid decision to not make the newer PPM's a free CPAN distribution, of course.
Frankly, this bothered me a little. So I wrote a module to convert PPM packages to PAR distributions [6]. Given the URI of a PPD document, it creates a .par file which you can install using PAR::Dist and without involving any PPM-related software at all. It's really quite simple:
ppd2par --uri http://theoryx5.uwinnipeg.ca/ppms/PDL.ppd -p 5.8
It's still a little more tedious than the nice PPM GUI, of course. So I wrote another tool which automatically appends the installation step [7]:
parinstallppd --uri http://theoryx5.uwinnipeg.ca/ppms/PDL.ppd
In some cases, it's necessary to tell it which implementation (5.6 or 5.8) to use because the repository maintainers do not provide great meta data. But it works fine for me. If you know how much work it can be to compile the PDL module, you will certainly agree! Still, this is not for the faint of heart, so yesterday, I wrote a GUI front-end [8]. It is not a package manager like PPM, but just the beginnings of a simple GUI front-end to the parinstallppd tool.
Since these tools require XML::Parser, which requires expat which is an external dependency, I have built a stand-alone executable from parinstallppdgui and put it on my home page [9]. Getting it to work properly with PAR required some trickery. Perhaps I'll explore that further in a separate journal entry.
So, wrapping it up, you can now enjoy the benefits of a Unixy Perl installation with the added benefit of installing precompiled PPM packages if necessary.
Cheers,
Steffen
As I mentioned yesterday on #win32, this is most excellent >:)
Re:But these days, ActivePerl does more!
tsee on 2006-12-24T00:25:08
Thanks for the comment. I have used MinGW + ASPerl before. It works pretty well, too.
The idea to make the mingw installation that comes with strawberry optional might be good. Or not. I'm not sure whether it's more valuable to be flexible or more valuable to have a reliable base installation which is certain to have a C compiler...
SteffenRe:But these days, ActivePerl does more!
bart on 2006-12-24T08:46:30
Think of it this way: for every minor upgrade of Strawberry Perl, it will include (archive is 24MB), and reinstall the C compiler.