CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Continue if module fails to load

 



tangle
New User

Jun 21, 2011, 9:48 AM

Post #1 of 7 (938 views)
Continue if module fails to load Can't Post

We are in the process of moving our servers from SCO to RHEL. There are some Perl scripts on the UNIX side that use NDBM_File. This module is no longer included in the Perl version of RHEL. In the other Perl scripts I just added an if statement to check if it is a Linux system. If it is it runs the linux version of the script and exits.

The problem I am having is the Perl dies if a module fails to load. My question is, is there a way to continue loading a script if a module fails to load? We want to keep the Unix scripts as original as possible. Thanks


FishMonger
Veteran / Moderator

Jun 21, 2011, 11:24 AM

Post #2 of 7 (933 views)
Re: [tangle] Continue if module fails to load [In reply to] Can't Post

Why not simply install the module on the linux servers?


tangle
New User

Jun 21, 2011, 11:31 AM

Post #3 of 7 (931 views)
Re: [FishMonger] Continue if module fails to load [In reply to] Can't Post

It is not on the DVD and we do not want to mess with the support agreement.


FishMonger
Veteran / Moderator

Jun 21, 2011, 11:39 AM

Post #4 of 7 (929 views)
Re: [tangle] Continue if module fails to load [In reply to] Can't Post

Installing a module voids your support agreement, but modifying the scripts don't? That doesn't make any sense and if it's true, you are being ripped off by that support agreement.

If you plan on modifying the scripts, you'll need to put OS checks and loading of the module in a BEGIN block and you may need to load the module with a 'require' statement instead of a use statement.


tangle
New User

Jun 21, 2011, 11:43 AM

Post #5 of 7 (927 views)
Re: [FishMonger] Continue if module fails to load [In reply to] Can't Post

I am not modifying any Perl modules. The scripts are part of our application. I'll look at loading the module with require. I already have a check at the beginning of the script. Thanks


tangle
New User

Jun 21, 2011, 11:50 AM

Post #6 of 7 (924 views)
Re: [tangle] Continue if module fails to load [In reply to] Can't Post

The require worked thanks.


rovf
Veteran

Jun 22, 2011, 4:12 AM

Post #7 of 7 (916 views)
Re: [tangle] Continue if module fails to load [In reply to] Can't Post

I don't see how installing a module could be influenced by a support agreement. Does your support agreement, for instance, also say that you are not permitted to install a text editor on any host which possibly can be reached by your application?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives