Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by 1nickt (Canon)
on Feb 19, 2020 at 22:47 UTC ( [id://11113196]=note: print w/replies, xml ) Need Help??


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

Hi, try

use Module::Load eval { autoload 'cPanelUserConfig'; 1 } or do_something_else();

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Using eval: $@ isn't returning the error I expect
by doctormelodious (Acolyte) on Feb 20, 2020 at 00:00 UTC
    Thanks, 1nickt

    I tried this:

    use Module::Load; eval { autoload 'cPanelUserConfig'; 1 } or print "toast";

    and got this error:

    syntax error at /Library/WebServer/CGI-Executables/orders/orderFormSal +esDisplayPreRollout.cgi line 15, near "autoload 'cPanelUserConfig'" Execution of /Library/WebServer/CGI-Executables/orders/orderFormSalesD +isplayPreRollout.cgi aborted due to compilation errors.

    When I commented out the eval statement, the script ran, which would indicate that Module::Load is indeed installed.

    Thanks again!

      use Module::Load; eval { autoload 'cPanelUserConfig'; 1 } or print "toast";

      This code works fine for me. Are you sure this is exactly the code you tried?

      Also, just to make sure, tell us what version of Perl and the module you're using, as given by perl -MModule::Load -le 'print $]; print $Module::Load::VERSION' (on the command line).

        Yes, I copied directly from the script and pasted it into my reply. My local machine is running Perl v5.18.2. Appreciate all the help!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-03-28 08:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found