in reply to Re: Captcha::reCAPTCHA::V2 Not Working
in thread Captcha::reCAPTCHA::V2 Not Working

I tried printing the headers before using the module, got the same results, "Internal Server Error" in the browser
#!/usr/bin/perl print "Content-type: text/html\n\n"; use Captcha::reCAPTCHA::V2; print "Hello World<br>\n"; exit;
Frustrated!

Replies are listed 'Best First'.
Re^3: Captcha::reCAPTCHA::V2 Not Working
by hippo (Archbishop) on Jan 11, 2019 at 09:17 UTC
    Frustrated!

    If you can't talk to your hoster then you need to investigate by yourself. Since use is a comile-time statement any failure in it will happen before your script even tries to run. Instead, go with require and wrap it in an eval block to trap the errors.

    #!/usr/bin/perl use strict; use warnings; print "Content-type: text/plain\n\n"; eval { require CGI::Carp; } or print "CGI::Carp not loaded: $@.\n"; eval { require Captcha::reCAPTCHA::V2; } or print "Captcha::reCAPTCHA::V2 not loaded: $@.\n"; print "End of script\n";

    Also, always check the full entries in the error log, not just the last line.

      Thanks for you kind help.

      The problem was fixed by adding this line:

      use lib '/home/username/perl5/lib/perl5';

      It would appear that the server was setup that any module that I installed is specific for my site only.

        "It would appear that the server was setup that any module that I installed is specific for my site only."

        Quite right too :) See local::lib.