Learn how to a build a cloud-first strategyRegister Now


How do I make CGI PERL scripts work properly within HTML?

Posted on 2007-09-27
Medium Priority
Last Modified: 2013-12-25
I am trying to set up my Intranet web page to allow for survey polling.  I have found a couple of PERL scripts which will allow me to do this with CGI however I can not get them to execute properly.  I am not sure what I am missing here.  I am trying to create a form to ask a set of questions and then I want to be able to output a set of answers based on the responses of the visitors.

With so many different possible languages to use, what would be the prefered one to use for this function?  Also, how would I go about making said program interact properly on my Intranet.  I am creating my pages with Front Page 2003 and I am quite familiar with HTML.  Thank you!
Question by:OCUW
  • 4
  • 3
LVL 39

Expert Comment

ID: 19975227
What part of them is not working  properly?
You should use whatever language you are familiar with, or would like to learn.  Perl is a popular language for web development.
LVL 48

Expert Comment

ID: 19975292
What errors (if any) do you get when you try to run the CGI scripts?

Please note that there are a lot of very badly written Perl/CGI scripts out there that you can download.  If you're not familiar with Perl, it can be difficult to establish whether it is well written or not.

A big red warning flag is if the script doesn't have:

use strict;
use CGI;

it usually means it is poorly written.

What programming languages are you familiar/comfortable with?  Remember that CGI scripts can be written in any programming language.

Additionally, you may want to consider ASP (which is mostly commonly written with VB) or PHP.

Author Comment

ID: 19975374
The error that I am receiving is not necessarily an error at all.  What is happening is the following.

I have a cgi script that I have written using perl which contains the following code within, test.cgi:

print "Content-type: text/html\n\n";
print "<html>This is a test</html>";

When I save and try to preview this in my browser I see the entirety of the script, where, if I am correct, I should only see "This is a test".  Does this sound wrong overall to you?

I am decently familiar with VB, I have not used it in a while, but I have a good foundation and grasp of the language.  I have also worked with C and C+
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 48

Expert Comment

ID: 19975460
You don't have a Perl problem, you have a CGI setup problem.  If you see the contents of a CGI program, it means the webserver hasn't been configured correctly to handle CGI programs.

Do you administer the webserver?

If you are familiar with VB, then ASP may be a good option for you, but it is obviously limited to Windows servers running IIS.

Author Comment

ID: 19975503
Yes, I administer the Web Server, however I have never actually done anything with CGI or PERL before this.  I have been searching the internet to no avail.  Can you perhaps explain to me what might be wrong on my server to be not allowing this?  I am running Windows Server 2003 and IIS.  Thanks again!
LVL 48

Accepted Solution

Tintin earned 2000 total points
ID: 19975538

Author Comment

ID: 19975539
So, having not used ASP before I just have a couple of questions there.

Do I need to configure CGI on my webserver if I am running ASP?
What DOES need to be configured in order to run ASP through my webpage?
ASP is coded right in with the HTML and therefore does not need to reference scripts which are created and stored elswhere within the site infrastructrue?

Thanks for all the help!
LVL 48

Expert Comment

ID: 19975604
ASP is a similar technology to CGI, but totally independent, therefore CGI does not need to be enabled to run ASP pages.

See http://www.visualwin.com/ASP/ for enabling ASP.

You are corrected that ASP pages have VB embedded in the HTML.  This is very similar to PHP and in fact, Perl can be setup to do exactly the same thing, although it is more common to use Perl with CGI.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Six Sigma Control Plans
Suggested Courses
Course of the Month21 days, 2 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question