----- Original Message ----- 
From: "Harter, Douglas" <[EMAIL PROTECTED]>
To: "Beginners Mailing List Perl (E-mail)" <[EMAIL PROTECTED]>
Sent: Thursday, September 11, 2003 4:46 AM
Subject: Conditional compilation


> I am writing a Perl script which will run on multiple machines. I have a
> use Expect;
> in the script.
>
> The problem is that Perl Expect is not currently installed on all the
> machines.
>
> Does Perl have any conditional compilation so that I can somehow NOT
execute
> the use statement on the machines that do not have expect? Or is there
> another way to handle this situation?
>
Hi -

'use' processing is done at compile-time, not run-time,
so run-time conditionals don't have any effect. Replace
your 'use' with 'require' and 'import' (resolved at
run-time) within conditionals, or check the results
on the 'require' ($@ I think) to determine if the module
is present. Play with it; check docs.

Aloha => Beau;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to