Bernd Lach wrote:
>Hi there,
>
>I have a problem in detecting any kind of environment
>variables.
>
>I always get a premature script error , when I launch sth like
>this.
>
>
>#!C:/Perl/bin/perl.exe -w
>use diagnostics;
>use strict;
>
>use CGI;
>
>$browser = $ENV{'HTTP_USER_AGENT'};
>
>if ($browser =~ /Mozilla/) {
> #
> # Netscape
> #
>} else {
> #
> # Non Netscape
> #
>}
>
>
>I run a apache 1.3.22 with activ perl build518
>what else do I have to say?
>
>I have no Idea...
>in my apache cgi is set up and i can run basic scripts from the
>prompt.
>
>who knows what I have to do?
>
>cheers.
>bernd
>
Just add:
print "Content-type: text/html\n\n"; before you print anything else
and on the other hand:
I recomend not to use $ENV{'HTTP_USER_AGENT'} if using CGI module
........ use user_agent() method instead:
my $q = new CGI;
my $uagent = $q->user_agent();
eGardz! ;-)
--
The Power to Serve! <http://www.freebsd.org/>
........................................
: Kliment Ognianov :
: Network Administrator & Developer :
: ISP Networks Department :
: BulInfo Ltd. :
:.....................................:
: ICQ #16864572, #64866894 :
:.....................................:
: http://www.bulinfo.net/ :
:.....................................: