Help for this page

Select Code to Download


  1. or download this
    my $module = $^O =~ /MSWin32/ ? "Win32::Foo" : "Unix::Bar";
    # /win/ will make Darwin (OSX) users unhappy :-)
    ...
    eval "use $module"
      or die "$module didn't return a true value";
    die $@ if $@;
    
  2. or download this
    BEGIN{
      if ($^O =~ /MSWin32/) {
    ...
        Unix::Bar->import();
      };
    };
    
  3. or download this
    use UNIVERSAL::require;
    my $module = $^O =~ /MSWin32/ ? "Win32::Foo" : "Unix::Bar";
    
    $module->require;
    $module->import(1,2,3);
    
  4. or download this
    BEGIN {
      my $module = $^O =~ /MSWin32/ ? "Win32::Foo" : "Unix::Bar";
    ...
    
      $module->import();
    };