use modules OS dependent

Discussion in 'Perl Misc' started by sledz@dresearch.de, Apr 14, 2008.

  1. Guest

    I'm writing an perl script which should communicate over a serial
    port. The script should be able to run in Linux and Win32
    environments. In both environments exist modules to access the serial
    port:

    Win32::SerialPort (under Windows)
    Device::SerialPort (else)

    I know it is possible to detect the OS using Config::Config. But it
    seems not possible to use different modules depending on this
    information like this:

    if ( $OS eq 'WINDOWS' ) {
    use Win32::SerialPort qw( :pARAM :STAT );
    } else {
    use Device::SerialPort qw( :pARAM :STAT );
    }

    What's the right way to write such an OS dependent application?

    Steffen

    PS: Fup to comp.lang.perl.modules
    , Apr 14, 2008
    #1
    1. Advertising

  2. Gunnar Hjalmarsson, Apr 14, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Remy Cool
    Replies:
    1
    Views:
    418
    Remy Cool
    Aug 27, 2003
  2. puzzlecracker
    Replies:
    1
    Views:
    503
    James Kanze
    Aug 7, 2008
  3. Abubakar
    Replies:
    3
    Views:
    1,062
    Gregory A. Beamer
    Aug 17, 2009
  4. Brandon Metcalf

    installing architecture dependent modules

    Brandon Metcalf, Mar 2, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    98
    Brandon Metcalf
    Mar 2, 2005
  5. Merrilee Larson

    Do I *have* to use 'OOP' to use modules?

    Merrilee Larson, Nov 17, 2006, in forum: Perl Misc
    Replies:
    41
    Views:
    355
    Arved Sandstrom
    Nov 25, 2006
Loading...

Share This Page