Connecting Tech Pros Worldwide Forums | Help | Site Map

How to use cgi tech with perl and how to use Win32:api

Newbie
 
Join Date: Jan 2007
Posts: 11
#1: Feb 1 '07
Hi Frds,

I am new to perl and cgi. I am posting data and i want to use that data in my test.pl through cgi.I have 2 questions.

First one is
================================================== =======

<form action="https://abc.com/cgi-bin/test.pl?servletLoc=<%=servletLoc%>&cmd=login&langu ageCD=ENG" method="post" id="login" name="login" autocomplete=off onSubmit=signin(document.login)>

I am using cgi in perl script which is given below

=======================
#!c:\perl\bin\perl.exe


use strict;
use CGI;
use CGI::Carp('fatalsToBrowser');
use Win32::Internet();
use URI::Escape;

use warnings;
use Win32::API;
use FindBin;


sub main()

{
print "Content-type: text/html\n\n";
my $query = new CGI;
my $inet = new Win32::Internet();


my $username = $query->param('userid');

print "<H1>$username</H1>\n";

}


main();

===========================
and am getting an error which says

================
Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.
===============
Y am getting this error.
================================================== =======

Second question

to use Win32::API;
Do we need to install anything on the server.
I am asking this because when i run the following code
I got the same error --- Error 500--Internal Server Error
=================
use strict;
use CGI;
use CGI::Carp('fatalsToBrowser');
use Win32::Internet();
use URI::Escape;

use warnings;
use Win32::API;
use FindBin;

print "Content-type: text/html\n\n";
print "<H1>username</H1>\n";
===================
and when i am removing this use Win32::API, its showing me the html output

Plz help me....

KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Feb 1 '07

re: How to use cgi tech with perl and how to use Win32:api


if you are getting a "500 internal server error" while using CGI::Carp /fatalsToBrowser/ in your scripts the problem is generally, the shebang line is wrong (the path to perl in the very first line) or that you uploaded the file in binary instead of ASCII mode. It could also be a permissions problem but if you are using a windows server that is probably not the case.



In the future, please do not prepend/append your questions with 'urgent'.
Newbie
 
Join Date: Jan 2007
Posts: 11
#3: Feb 7 '07

re: How to use cgi tech with perl and how to use Win32:api


Thanks for the information Kevin.

I have fixed the problem, it was due to use Win32::Internet();
To use use Win32::Internet(); we need to install some API module.

I copied the Win32-API-0.46.tar.gz file in to d:\perl\bin\
and I Installed the API module form the cmd prompt

** d:\perl\bin\>ppm install Win32-api

and thn perl script run.

Cheers !!!

Thanks again
Reply


Similar Perl bytes