Hello Mongers,<br><br>I have what seems like it should be a simple problem (and it probably is!), but I'm not finding the simple solution, so I'm hoping somebody can give me the right answer off the top of their head.<br>

<br>So the group I work with shares a perl script to run multi-hour builds (of C++, on windows boxes, with visual studio 9). Usually we try to rebuild the whole shebang overnight, and then work on it all day. But sometimes we have to build during the day, and the computer can bog down.<br>

<br>So yesterday I added this bitchin little tweak to allow the script to demote its own windows priority to "Below Normal", which in turn governs the priority of all the build tasks it spawns. Suddenly, it's a lot easier to get work done while the computer is building. Yay.<br>

<br>But, I discovered today that not all of us developers have the same install of ActiveState (and it's not possible to mandate them to all upgrade to 5.10), and older versions of Win32::Process do not offer the symbols BELOW_NORMAL_PRIORITY_CLASS and ABOVE_NORMAL_PRIORITY_CLASS (presumably because win2K or pre-win2K did not have those priorities), so they cannot <br>

<br>    use Win32::Process qw[ BELOW_NORMAL_PRIORITY_CLASS ABOVE_NORMAL_PRIORITY_CLASS ];<br><br>and the perl script borks.<br><br>What I could do is modify the script so that the only possible priority-switching option is to change to LOW.<br>

<br>What I'd rather do is allow every user access to every priority that their Win32::Process makes available to them. Is there a perl statement that will tell me whether Win32::Process is able to export the symbols I want, without actually trying to import them and killing the script?<br>

<br>For reference, the trivial script below works for me, but not for the outdated. If this could be made to detect whether the symbols are available, and switch to low/high if they are not, that would solve my problem.<br>

<br><br><br><span style="font-family: courier new,monospace;">use Win32::Process;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">use Win32::Process qw[ BELOW_NORMAL_PRIORITY_CLASS ABOVE_NORMAL_PRIORITY_CLASS ];</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">my $pid = Win32::Process::GetCurrentProcessID();</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">print "PID is $pid\n";</span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">$i = 100;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$dt = 5;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">while ($i) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  print "Sleeping for $dt seconds; $i\n";</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  sleep $dt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  $i--;</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  my $proc;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  if (Win32::Process::Open($proc, $pid, 0)) {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    my $class;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    $proc->GetPriorityClass($class);</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    print "Priority class is $class\n";</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    if ($i%2) {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      print "Changing class to BELOW NORMAL\n";</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      $proc->SetPriorityClass(BELOW_NORMAL_PRIORITY_CLASS);</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">    } else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      print "Changing class to ABOVE NORMAL\n";</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">      $proc->SetPriorityClass(ABOVE_NORMAL_PRIORITY_CLASS);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    }</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  } else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    print "Can't find myself as PID=$pid\n";</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">  }</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;">

<br><br><br><br><br>