Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Conditional use of Win32::TieRegistry

by Discipulus (Canon)
on Nov 13, 2017 at 19:01 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1203281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-24 10:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found