This is progress, Thanks.  

I call a function, runTestHarness() that uses the Win only Iprocess mod.   If I 
comment out the few lines in this function that use the words imported from 
Iprocess.pm, everything compiles.  But when I include the lines in the function 
(example below), I get an error like:

        "Bareword 'INHERITED' no allowed while 'strict subs' in use"
        
Is there a way to conditionally compile the code in the runTestHarness function as 
well?

Thanks again, this is a big help!
-Noah

THE CODE
------------------------------

BEGIN {
        if($^O =~ /Win32/)
        {
                # now importing all the constants               
                
                eval "use Win32::IProcess
                qw( SW_SHOWNORMAL SW_SHOWDEFAULT SW_SHOWMAXIMIZED SW_HIDE SW_SHOW 
SW_MAXIMIZE FOREGROUND_RED 
                FOREGROUND_GREEN FOREGROUND_BLUE BACKGROUND_RED BACKGROUND_GREEN 
BACKGROUND_BLUE
              FOREGROUND_INTENSITY NORMAL_PRIORITY_CLASS PROCESS_ALL_ACCESS INHERITED 
FLOAT
                DIGITAL NULL CREATE_NEW_CONSOLE NOPATH)"; 
        }
}

......

sub runTestHarness
{
        ...
        $procManager->Create("${harnessBuild}/${buildToTest}"," 
-mmjs=dw.runCommand(\"JsTests")",INHERITED,CREATE_NEW_CONSOLE,".",NULL,SW_SHOWDEFAULT,200,200,300,300,"");

}


-----Original Message-----
From: Chris Nandor [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 31, 2002 12:20 PM
To: Matt Morse
Cc: Noah Hoffman; Matt Morse; '[EMAIL PROTECTED]'
Subject: Re: [MacPerl] Can you make "use" platform specific?


At 11:55 -0700 2002.07.31, Matt Morse wrote:
>I think it would work to put it in an eval:
>
>if($^O =~ /Win32/)
>       eval "use Win32::IProcess.pm";
>}

Also, if you need the compile-time effects of use, then wrap that in a
BEGIN {}.

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to