joephus has asked for the wisdom of the Perl Monks concerning the following question:

I have a question about the Crypt-PasswdMD5 module and was wondering if anyone here might be able to help. I inherited this web app from a developer that is no longer working for this company. The application is dieing with http 500 error when it tries to call the unix_md5_crypt subroutine. Since this app worked before migrating servers, I figured I was just missing this perl package. I ran the makefile and installed the module. The module information pulls up just fine from perldoc so as far as I can tell it is installed correctly, but I'm still getting the undefined Subroutine error. Am I missing something with the Crypt-PasswdMD5 module? Any troubleshooting tips or ideas? TIA, Joe
  • Comment on Undefined Subroutine &main::unix_md5_crypt

Replies are listed 'Best First'.
Re: Undefined Subroutine &main::unix_md5_crypt
by kyle (Abbot) on Sep 12, 2008 at 20:16 UTC

    If you have a use line for Crypt::PasswdMD5, and it's not installed, things should die right there.

    If you have a require line for Crypt::PasswdMD, and your program makes it past that OK, that also proves that you have it installed, but you'll still get the error you're getting. In that case, change the "require" to "use" instead.

    If your program does not ever "use" or "require" Crypt::PasswdMD5, you need to add that.

    use Crypt::PasswdMD5;

    If that doesn't work, I'm guessing you have an installation problem.

Re: Undefined Subroutine &main::unix_md5_crypt
by MidLifeXis (Monsignor) on Sep 12, 2008 at 20:14 UTC

    Is the web application using the same perl (and perl library), @INC settings, PERL5LIB environment variable, etc as your command line?

    --MidLifeXis

Re: Undefined Subroutine &main::unix_md5_crypt
by oko1 (Deacon) on Sep 13, 2008 at 02:05 UTC

    Try testing it from the command line.

    perl -MCrypt::PasswdMD5 -wle'print unix_md5_crypt("password")'

    You should not get any errors when you run the above; if you do, then your installation of Crypt::PasswdMD5 may be messed up.

    If the above test succeeds, then I'd suggest expanding the tests in your CGI. Ensure that your program contains the following at the top (you may need to adjust the level of spices and the cooking time somewhat to suit your own palate):

    #!/usr/bin/perl -wT use strict; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; use CGI qw/:standard/; $|++;

    If you still haven't solved the problem at that point, you'll at least have plenty of ammunition for troubleshooting it - or for reporting the exact error here rather than just an "http 500 error".

    
    -- 
    Human history becomes more and more a race between education and catastrophe. -- HG Wells