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

Don't nail me on that, but iirc
End of script output before headers
means that there is output written to STDOUT before the http-headers are written thereto. Try printing the headers before using the module. That way you can check the output for something unexpected.


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re^2: Captcha::reCAPTCHA::V2 Not Working
by soonix (Chancellor) on Jan 11, 2019 at 08:00 UTC
    use is done before any print. If CGI::Carp is available, insert
    use CGI::Carp 'fatalsToBrowser';
    right after she shebang line.

    Update: better:

    use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

Re^2: Captcha::reCAPTCHA::V2 Not Working
by jack778 (Initiate) on Jan 11, 2019 at 04:46 UTC
    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!
      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.