Hi all,

I need to load a different library, depending on the platform I am running on.

When running on Linux, I need "Device::SerialPort";
while running on Windows I need "Win32::SerialPort".

This is what I came up with:

if ( $OS eq "linux" ) { use Device::SerialPort qw( :PARAM :STAT 0.07 ); }
elsif ( $OS eq "MSWin32" ) { use Win32::SerialPort  qw( :PARAM :STAT 0.07 ); }
else { die "Unsupported Operating System: $OS\n"; };

But the loading of the libraries is done during compile and therefore this will allways 
fail with an "Can't locate ..../SerialPort.pm in @INC".\

How can I load a library depending on the platform I run on?

Thanks!

JP

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to