Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Conditional use of Win32::TieRegistry

by Discipulus (Abbot)
on Nov 13, 2017 at 19:01 UTC ( #1203281=note: print w/replies, xml ) Need Help??


in reply to Conditional use of Win32::TieRegistry

Hello hilitai

you can check $^O to see if you are running on windows: see perlvar then require the module and eventully import, if the module uses Exporter's import.

if ($^O eq 'MSWin32'){ require Win32::TieRegistry; Win32::TieRegistry -> import if Win32::TieRegistry -> can ("import" +); }

See also use module if condition is met for suggestion about if module.

PS this kind of things are worth to reside into a BEGIN block.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2021-05-14 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (150 votes). Check out past polls.

    Notices?