Phil Schaechter wrote:
> I have a program that has an optional GUI which makes use of
> Tk.  On machines
> without Tk, the program errors out looking for the Tk
> modules.  Currently, I
> am just saying
> 
> use Tk;
> 
> Is there some method I can use that will prevent it from
> dying in the event Tk
> is not on the current machine?  Or, is there a way that I can make it
> not load the Tk modules until I actually need them within the program?

The general solution is to wrap the "use" in an eval():

   eval "use Some::Module";
   if ($@) {
      # module not found or some other problem
   }

I'm not sure if there are any caveats with this approach WRT the Tk
module...

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

Reply via email to