Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

acme (189)

  (email not shown publicly)

Leon Brocard (aka acme) is an orange-loving Perl eurohacker with many varied contributions to the Perl community, including the GraphViz module on the CPAN. YAPC::Europe was all his fault. He is still looking for a Perl Monger group he can start which begins with the letter 'D'.

Journal of acme (189)

Wednesday December 12, 2001
07:15 AM

Portable Perl

[ #1613 ]
Perl, it has been said before, is a thin layer on top of your operating system which makes everything look like Unix. When you're coding a large application that might be deployed on lots of different platforms, you tend to worry about portability. There is even a perlport manpage to help you write portable Perl - the most useful module being the File::Spec module to portably perform operations on file names.

At my current workplace, I'm working on OpenFrame, an application framework. Our two main testing platforms were Linux/i386 and Darwin/ppc, and we wanted to know how portable the code really was. At the end of last week, I tested OpenFrame on 17 varied platforms and it worked fine on all of the following: Caldera OpenLinux 3.1 / i386, Darwin 5.1 / PowerPC, Debian Linux 2.2 / Alpha, Debian Linux 2.2 / i386, Debian Linux 2.2 / PowerPC, Debian Linux 2.2 / Sparc, FreeBSD 4.4 / i386, Mandrake Linux 8.1 / i386, NetBSD 1.5.1 / Alpha, RedHat Linux 7.1 / Itanium, RedHat Linux 7.2 / i386, SunOS 5.8 / Sparc, SuSE Linux 7 / i386, SuSE Linux 7 / S/390, Tru64 5.1a / Alpha, TurboLinux 6.5 / i386, and Slackware 8.0 / i386. That's a lot of platforms (and a lot of architectures!), so how did I do this?

There are services on the Net which provide remote access (usually via ssh) to a wide range of architectures for testing and porting purposes. The three services I used are: SourceForge Compile Farm (mostly Linux boxes), Compaq Test Drive (mostly Alpha boxes, although also Itanium) and IBM Linux Community Development System (S/390). Check them out, they are all pretty cool, and more importantly, free. It normally takes a day or so to gain access to the systems and once you're in, each computer in the farm uses NFS-ed home directories to make porting easier.

However, all these systems came with old versions of Perl, and more importantly, I didn't have permissions or general Net access to install extra modules. OpenFrame strictly follows the "don't reinvent the wheel" philosophy, which is a bit of a pain sometimes (we have a pretty large list of prerequisite modules) but good in general. So, I built a local copy of a recent version of Perl in my home directory on my local machine (with ./configure.gnu --prefix=/home/acme/), and installed all the required modules. This took a while, but did it for me. I then copied this tarball of Perl around all the compile farm machines. At this point, I had a working installation except for architecture problems: the perl binary and any XS modules weren't compiled for the current architecture (note that the normal Perl modules were ready to work though). So all I had to do was compile and install perl and the modules that used XS (HTML::Parser, Storable, Time::HiRes, TT...), and then I could run make test in the OpenFrame directory and add to the list of platforms OpenFrame works on.

Of course, I was only able to achieve this as I have spent the past couple of weeks adding a comprehensive test suite to OpenFrame (189 tests atm), including one which forks a standalone preforking HTTP server and then tries to connect to it. If OpenFrame passes the tests, we can be sure that all of it works.

This was relatively painless apart from taking up some of my time. Automating it could actually be possible. However, the thing that amazed me is that OpenFrame worked without patching on all of those platforms - Perl is pretty portable and using this method, so could your code...

A big thanks out to the guys operating these services. You guys rock!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.