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

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

by ikegami (Patriarch)
on Jun 29, 2006 at 07:15 UTC ( [id://558239]=note: print w/replies, xml ) Need Help??


in reply to Re: 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?

Update: While trying to reproduce the problem minimally, I realized I misunderstood what I read earlier or what I read was wrong. Disregard this post.

I don't have that module, but I don't see how your solution could work. Win32::DriveInfo::DriveSpace('c:') is still being compiled before use Win32::DriveInfo; is executed, so the prototype mismatch is still present.

Replies are listed 'Best First'.
Re^3: How to execute succcessful this Perl script in Linux, window and solaris?
by shmem (Chancellor) on Jun 29, 2006 at 07:32 UTC
    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}

      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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 22:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found