in reply to Conditional use of Win32::TieRegistry

Hi, see if:

use if $^O =~ 'MSWin32', 'Win32::TieRegistry';
(not sure about the regex, not a Windows user).

Hope this helps!

Update: added quoting to module name, see below


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Conditional use of Win32::TieRegistry
by hilitai (Monk) on Nov 13, 2017 at 19:15 UTC

    Works for Windows, fails on Linux:

    Too few arguments to `use if' (some code returning an empty list in list context?) at /usr/lib/perl5/5.10.0/if.pm line 7.

      Sorry, missed quoting the module (necessary if no args provided, like use if CONDITION, MODULE => ARGUMENTS;)

      Should be:

      use if $^O =~ 'MSWin32', 'Win32::TieRegistry';
      ... but I'm sure you saw that in the doc I linked to, right?


      The way forward always starts with a minimal test.