Cross Platform Perl

Rob Casey rob at
Wed Oct 16 22:23:34 CDT 2002

As a starting point ... This is how I would do it, making use of the
eval statement with a string argument.

eval "use Win32::Registry" if $^O =~ /Win32/;
die 'Cannot load Win32::Registry module - ', $@ if $@;


Rob Casey
Business Manager, Senior IT Consultant
Cowsnet Internet and Professional Services


-----Original Message-----
From: owner-melbourne-pm at [mailto:owner-melbourne-pm at] On
Behalf Of Adam Clarke
Sent: Thursday, 17 October 2002 12:43 PM
To: melbourne-pm at
Subject: Cross Platform Perl

Hi all,

I'm trying to write a script that runs on Linux (Unix) and Win32. I want

to /use/ a module when on Win32 (to access the registry) that doesn't 
exist in Unixy perl. Is there a way to skip a use statement at runtime 
based on platform or is the only/best way to make a full build 
(MakeMaker thing) and handle the differences there somehow. If the 
latter, anyone got some simple pointers.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3222 bytes
Desc: not available
Url :

More information about the Melbourne-pm mailing list