Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > more robust way to handle missing modules?

Reply
Thread Tools

more robust way to handle missing modules?

 
 
dt
Guest
Posts: n/a
 
      04-07-2007
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?

 
Reply With Quote
 
 
 
 
Martijn Lievaart
Guest
Posts: n/a
 
      04-07-2007
On Sat, 07 Apr 2007 00:44:10 -0700, dt wrote:

> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a more elegant way to handle determing fail status? J Python 3 01-16-2013 02:55 AM
Re: Is there a more elegant way to handle determing fail status? Oscar Benjamin Python 0 01-15-2013 11:56 PM
What is the best way to handle a missing newline in the following case chad Python 4 11-05-2010 03:54 PM
execnet-1.0.1: more robust and rapid python deployment holger krekel Python 0 12-05-2009 06:37 PM
A robust way to remove white spaces (RegExp) VK Javascript 3 05-25-2006 03:00 PM



Advertisments