in reply to Re^2: How to execute succcessful this Perl script in Linux, window and solaris?
in thread How to execute succcessful this Perl script in Linux, window and solaris?

Darn... too early in the morning.

what I really meant is the following at the very beginning of the script:

BEGIN { if ($^O =~ /^(MS)?Win/) { eval "use Win32::DriveInfo"; } }

Thanks for another slap ;-)

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
  • Comment on Re^3: How to execute succcessful this Perl script in Linux, window and solaris?
  • Download Code

Replies are listed 'Best First'.
Re^4: How to execute succcessful this Perl script in Linux, window and solaris?
by ikegami (Patriarch) on Jun 29, 2006 at 07:41 UTC

    That does the trick.

    # Module.pm package Module; INIT { print("ok\n"); } 1;
    >perl -we "use Module" ok >perl -we "require Module if $^O =~ /Win/" Too late to run INIT block at Module.pm line 3. >perl -we "eval 'use Module' if $^O =~ /Win/" Too late to run INIT block at Module.pm line 3. >perl -we "BEGIN { eval 'use Module' if $^O =~ /Win/ }" ok

    Update: The if pragram is useful here:

    >perl -we "use if $^O =~ /Win/, 'Module'" ok