more robust way to handle missing modules?

D

dt

I am having trouble with some modules that are not on all of my
servers.

I use about 15 different web hosting companies to host my site. I am
having trouble with one particular module, since it either is not
located on each web host account or I can't upload it.

usually I just upload my own version and everything runs fine, but in
some cases I get an error message that says that the module conflicts
with another version of the same module. my only solution has been to
not use that web host for that piece of code, which I have to manually
disable.

is there any way to use an eval {} or something similar to try to
require a module without having the server fail with a server 500
error?
 
M

Martijn Lievaart

is there any way to use an eval {} or something similar to try to
require a module without having the server fail with a server 500 error?

I think this will do the trick.

BEGIN { unless (eval "use nonexistent") { print "not found\n"; exit; } }

HTH,
M4
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top