in reply to Testing if machine has LWP... not working

You should be checking $@ for an error after an eval.
  • Comment on Re: Testing if machine has LWP... not working

Replies are listed 'Best First'.
Re^2: Testing if machine has LWP... not working
by ikegami (Patriarch) on Nov 22, 2006 at 02:02 UTC

    No need. eval returns undef on expection. Otherwise, it returns true because of the 1;. It would return true even without the 1; because require always returns true or an exception.

    Incidentally, eval EXPR is not needed here. eval BLOCK suffices.

    if (eval { require LWP::UserAgent })