The only time I've ever used
Win32::Process is when I wanted to test whether I could connect to a remote resigtry. What would happen is that on some machines, it would hang and the script would basically stop.
I'm not sure what exactly you want to do, but Win32::Process is basically going to launch another application from your script. Here's what I did to launch a perl one-liner to test whether or not the connection attempt would hang.
sub RegConnect {
my ($pObj, $ExitCode);
my $comp = shift;
my $pString = "perl -MWin32::TieRegistry -e " . '"' .
'$Registry->Connect(' ."'" . $comp .
"', 'LMachine');" . '"';
Win32::Process::Create($pObj,
"c:\\perl\\bin\\perl.exe",
$pString, 0,
NORMAL_PRIORITY_CLASS,
".")|| die "Can't create Perl Process: $!\n";
$pObj->Wait(7000);
$pObj->GetExitCode($ExitCode);
if ($ExitCode) {
$pObj->Kill(1);
return 0;
}
return 1;
}
Hope that's helpful,
Rich
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.