SPUG: Win32::Process

Andrew Sweger andy at n2h2.com
Mon Jun 18 15:06:30 CDT 2001


'require' and 'use' are a little different. Try this in your BEGIN:

require Win32::Process;
import Win32::Process;

On Jun 18, 2001 @ 1:09pm, North, Walter wrote:

> Greetings from Montana.
> 
> I have a perl script which runs on Unix/Linux/Widoze
> 
> I wanted to use Win32::Process if it was running on a Windows box.
> 
> So, I put in, after many foulups
> 
> BEGIN {
> use POSIX qw(uname);
> ($kernel, $hostname, $release, $version, $hardware) = uname();
>         if ( $kernel eq "Windows NT") {
>         require Win32::Process;
>         }
> }
> 
> Everything seemed ok, but apparently some of the module did not load or
> loaded wrong and the script now hangs up whilst running 
> 
>   $Result = Win32::Process::Create ( $Process, $HARBORCMD, $CMDLINE,
> $bInherit, $Flags, $HAR
> BORDIR );
>   if ( $Result ) { print "$MSG\n"; $Process->Wait(INFINITE); }
>   else { print "Error: " . Win32::FormatMessage( Win32::GetLastError() ); }
> }
> 
> A collegue who is more NT knowledgable then me assures me it is the
> Wait(INFINITE) part that is not working.  ie it goes out and waits
> infinitely and never returns.
> 
> Note:  If instead of BEGIN I used use Win32::Process the script worked, but
> not on a unix box cause there is no Win32::Process module.
> 
> So, finally the question:
> 
> Is there a problem with Win32::Process, or is my code with the Wait in it
> incorrect?

-Andy


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list