Cross Platform Perl
Rob Casey
rob at cowsnet.com.au
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 $@;
Regards,
Rob
Rob Casey
Business Manager, Senior IT Consultant
Cowsnet Internet and Professional Services
http://www.cowsnet.com.au
-----Original Message-----
From: owner-melbourne-pm at pm.org [mailto:owner-melbourne-pm at pm.org] On
Behalf Of Adam Clarke
Sent: Thursday, 17 October 2002 12:43 PM
To: melbourne-pm at pm.org
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.
Cheers
Adam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3222 bytes
Desc: not available
Url : http://mail.pm.org/archives/melbourne-pm/attachments/20021017/b2009de0/smime.bin
More information about the Melbourne-pm
mailing list