You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sean Davis <sd...@mail.nih.gov> on 2006/01/05 17:20:09 UTC

[users@httpd] Perl cgi question

I have a simple perl cgi script.  It runs fine from the command line from
the cgi-bin directory, but not in the browser.  I'm sure it is something
simple, but any ideas why it works from the command line but not the
browser?  Here is the error_log output:

[Thu Jan 05 10:20:45 2006] [error] [client 127.0.0.1] Can't locate
Dog/HTML/DogForm.pm in @INC (@INC contains: /Users/sdavis/Docum
ents/workspace/DogDB/lib
/System/Library/Perl/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darw
in-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl
/Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/P
erl/5.8.6 /Network/Library/Perl
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.8.6 /Li
brary/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1 .) at
/usr/local/apache2/cgi-bin/testcgi.pl line 7.
[Thu Jan 05 10:20:45 2006] [error] [client 127.0.0.1] BEGIN
failed--compilation aborted at /usr/local/apache2/cgi-bin/testcgi.pl l
ine 7.
[Thu Jan 05 10:20:45 2006] [error] [client 127.0.0.1] Premature end of
script headers: testcgi.pl

And the testcgi.pl script:

#!/usr/bin/perl
use strict;

use lib '/Users/sdavis/Documents/workspace/DogDB/lib';

use CGI;
use Dog::HTML::DogForm;

my $form = Dog::HTML::DogForm->new;

display_page($form);

sub display_page 
{ 
    my $form = shift;
    
    my $q = CGI->new();
    
    print $q->header();
    print $q->start_html();
    print $form->start_html;
    foreach my $field ($form->fields) {
        print $field->html . "\n";
    }
    print $form->end_html;
    print $q->end_html();
}

Finally, the Scriptalias directive and Directory:

ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>



Thanks,
Sean



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org