SPUG: Win32::Process

ced at carios2.ca.boeing.com ced at carios2.ca.boeing.com
Mon Jun 18 15:31:59 CDT 2001


>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:

> s there a problem with Win32::Process, or is my code with the Wait in it
>incorrect?

One problem, likely to be relevant, is that 'use' imports into your 
namespace while while 'require' doesn't (see perldoc perlmod,
perldoc -f use, perldoc -f require etc.) 

perl -MWin32::Process -le "print INFINITE"
4294967295

or equivalently:

perl -le "BEGIN{ require Win32::Process; import Win32::Process };
print INFINITE"
4294967295

Also, you'd also need to wrap the OS specific stuff (see
'perldoc perlport' for discussion of issues here):


if ( $^O =~ /MSWin32/ ) {  
   $Result = Win32::Process::Create ( $Process, $HARBORCMD, $CMDLINE,
}

Rgds,
--
Charles DeRykus

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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