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

Hi, I am new to PERL and I am trying to pass a textarea value from a PHP form to a PERL script but I am unable to do so.
I got this from one friend <?php ?> <form method="post" action="script.pl"> <textarea name="mytextarea">textarea content</textarea> <input type="submit" name="submit" value="submit" /> </form>
perl script
#!/usr/bin/perl use strict; use warnings; use CGI ':standard'; my $mytextarea = param('mytextarea'); print "Content-type: text/html\n\n"; print "$mytextarea";
but I am getting this
"Server error! The server encountered an internal error and was unable to complete yo +ur request. Error message: Premature end of script headers: *.pl"
I am using XAMPP on Vista
Can anybody help me on this plz?

Replies are listed 'Best First'.
Re: Submit PHP form to perl script
by wind (Priest) on Apr 06, 2011 at 03:49 UTC
    Add the following to just after use CGI
    use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
    Wrap your param in actual html
    print "<html><body>Hello world = '$mytextarea'</body></html>";
    And try adding the following to the end of your perl script:
    1; __END__
    In summary
    #!/usr/bin/perl use strict; use warnings; use CGI ':standard'; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); my $mytextarea = param('mytextarea'); print "Content-type: text/html\n\n"; print "<html><body>Hello world = '$mytextarea'</body></html>"; 1; __END__
      I added that but the same error persists :(
Re: Submit PHP form to perl script
by thezip (Vicar) on Apr 06, 2011 at 04:09 UTC

    What does your webserver's error log file say?


    What can be asserted without proof can be dismissed without proof. - Christopher Hitchens
Re: Submit PHP form to perl script
by wfsp (Abbot) on Apr 06, 2011 at 08:03 UTC
    Apache reads the shebang line. Is that where your perl is?

      This was resolved over at perlguru.

      But yes, it appears his perl wasn't installed correctly.