more robust way to handle missing modules?

Discussion in 'Perl Misc' started by dt, Apr 7, 2007.

  1. dt

    dt Guest

    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?
    dt, Apr 7, 2007
    #1
    1. Advertising

  2. 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
    Martijn Lievaart, Apr 7, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. holger krekel
    Replies:
    0
    Views:
    352
    holger krekel
    Dec 5, 2009
  2. lkcl
    Replies:
    4
    Views:
    219
  3. chad
    Replies:
    4
    Views:
    214
    Neil Cerutti
    Nov 5, 2010
  4. VK
    Replies:
    3
    Views:
    102
    Thomas 'PointedEars' Lahn
    May 25, 2006
  5. J
    Replies:
    3
    Views:
    162
    Steven D'Aprano
    Jan 16, 2013
Loading...

Share This Page