Cross Platform Perl
rickm at isite.net.au
rickm at isite.net.au
Wed Oct 16 22:53:16 CDT 2002
G'day Adam,
>From the POD you can replace a 'use' with a 'require' and 'import' inside a
BEGIN block. Thus you can also add an 'if' in there:
BEGIN {
if ($platform eq 'Win32') {
require Module; import Module LIST;
}
}
Cheers!
Rick Measham
Quoting Adam Clarke <Adam.Clarke at StrategicData.com.au>:
> 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
More information about the Melbourne-pm
mailing list