Ing. Branislav Gerzo wrote: > Hi all, > > recently I've updated perl on FreeBSD machine to latest, but my > modules go away, they are not in @INC. I have 2 questions: > 1. is there possibility update perl, without modules going away? > 2. I have some perl CGIs on server, now I have 500 internal server error > because some modules are missing. Is there possibility, when some > module is missing in perl script, I will call my own sub? > > Thanks > >
Part 2: Generally you can load a module wrapped in an eval and in the case that it is not installed you will trap the exception and then you could load your own code. perldoc -f eval perldoc -f require For instance.... my $use_module = 1; eval { require CGI; import CGI; }; if ($@) { warn "Module missing: $@"; warn "Falling back to my own code."; $use_module = 0; } if ($use_module) { # call module code.... print "Running module code....\n"; } else { # call your own code.... print "Running my own code....\n"; } http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>