# Re: Perl / CGI

> Charlie Deckert schrieb:
>
> Greetings all! Happy Holidays..;-)
^^
Merry X-mas to you and all pi3-users too!

>
> Ok I have been using Pi3 for about three months I have never done anything
> other than let the server run. LOL I am running Pi3Web on a Windows 98
> machine. So now I am wanting to run CGI stuff. I installed Perl for Win32 and
> all seems fine I can test the CGI scripts at the command line by typing (perl
> script.pl). When I try to run the script from the browser I am getting "ERROR
> reading response headers from cgi program" Start of command line is perl
> C:\pi3web\cgi-bin\my.script.pl"   With CGI the first line is usualy # !
> usr/local/bin/perl or what ever, my question is under the WIN 32 environment
> what should that line read? Is this the cause of the error I am getting? I
> will not be getting very complex I just want to run some simple scripts. One
> more thing when specifing the absolute and relative paths in some scripts,
> what should they be using pi3web.
^^
If the script runs from command line look at the first line printed by the
script on your screen. The line should be "Content-Type: text/html"
depending on the content type. Before the first content line starts an empty
line is needed. The corresponding line in your perl source code must be

print "Content-Type: text/html\n\n";

You wondered about the first line in your perl scripts (#!/usr/bin/perl).
This is a typical feature of Unix shells. The first line of a script is the
command line call of the program (with options) to execute the script itself.
This feature is similar to registering a file extension in Windows 95/98/NT.
If you use the script with a Windows version of perl this line is ignored.
But if you want to publish your perl stuff and it should work platform
independant (also on a Unix machine) do not delete this line.

I added a simple script to print out your CGI-environment. It is tested and
should run at once.

>
> Regards
> Charlie Deckert
> Director, Information Systems
> Nor-Lea General Hospital
> Phone (505) 396-6611
> FAX (505) 396-3729

--
with regards
Holger

---------------------------------------------------------
Holger 'Zimpel' Zimmermann    Contact me:
---------------------------------------------------------
Wendishain                    tel./fax company: on demand
Germany                       tel./fax private: on demand
---------------------------------------------------------
homepage: http://home.t-online.de/home/zimpel/
web server: surf to it from my homepage (online every
Sunday 20:00-24:00 GMT, start shifted again)
e-Mail:     zimpel@t-online.de
--------------------------------------------------------


getenv.pl

• References:
• Perl / CGI
• From: "Charlie Deckert" <chazman@bnserve.com>