in reply to [SOLVED] Using eval: $@ isn't returning the error I expect

The reason why this fails is that use statements are always evaluated at compile time, even if in a conditional. You could just drop the unless line because if the eval succeeds, then the module is actually loaded.

However, in such a situation I'd just add my own dummy cPanelUserConfig somewhere into my include path and get rid of that ugly string eval in production which would silently hide any errors in the real cPanelUserConfig module.

  • Comment on Re: Using eval: $@ isn't returning the error I expect

Replies are listed 'Best First'.
Re^2: Using eval: $@ isn't returning the error I expect
by doctormelodious (Acolyte) on Feb 19, 2020 at 23:44 UTC
    Hi haj,

    Thanks for the reply!

    >>I'd just add my own dummy cPanelUserConfig somewhere into my include path

    How would I go about doing that?

      Just create a file named cPanelUserConfig.pm that contains a single line of:
      1;
      Place that file in one of the @INC directories.
      You can get a list of those directories by running:
      perl -le "print for @INC;"
      Cheers,
      Rob
        Thanks!