Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by haj (Vicar)
on Feb 19, 2020 at 23:01 UTC ( [id://11113198]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11113198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 22:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found