Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Conditional use of Win32::TieRegistry

by 1nickt (Abbot)
on Nov 13, 2017 at 18:58 UTC ( #1203280=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1203280]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2021-05-07 02:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (83 votes). Check out past polls.

    Notices?