How do I conditionally use a Perl module only if I'm on Windows?

后端 未结 4 750
醉话见心
醉话见心 2021-02-14 22:43

The following Perl code ..

if ($^O eq \"MSWin32\") {
  use Win32;                                                                                                         


        
4条回答
  •  醉梦人生
    2021-02-14 23:25

    In general, use Module or use Module LIST are evaluated at compile time no matter where they appear in the code. The runtime equivalent is

    require Module;
    Module->import(LIST)
    

提交回复
热议问题