Solved

new to cgi

Posted on 2003-12-03
6
359 Views
Last Modified: 2013-12-25
Hi I have developed web applications using JAVA , JSP . but never into cgi  programming for dynamic content.

Most of the times i worked on Windows. Can somebody let me know how can i create sample dynamic webpage that displays current date using perl?

I have following questions
1)Which server i have to use??(I currently use apache tomcat for my java sites)
2)Do i have to have unix on my system
3)Is there any resource on internet to guide step by step

One of my friend has his website hosted on one of the hosting companies.He wants me to add dynamic content like uploading files , his hosting company has cgi scripting support. I want to know the procedure of how i can run my scripts on those

Thanks
0
Comment
Question by:soft_techy
  • 2
6 Comments
 
LVL 3

Expert Comment

by:mrh30
ID: 9873586
1) Almost every web server will have support for Perl.
2) Perl will run under Windows as well as Unix, but I've only ever run it under Unix and I don't really know how to get it running under Windows.
3) Your best bet would be to start at the following:

http://www.perl.com

Or get hold of either of the big two O'Reilly Perl books (Llama book and Camel book).
0
 
LVL 1

Author Comment

by:soft_techy
ID: 9874700
Can u help me setup simple dynamic web page(may be displaying date) on tomcat using perl.. I dunno about directory structure.

Thanks
0
 
LVL 3

Accepted Solution

by:
mrh30 earned 125 total points
ID: 9874732
On our webserver, we put scripts in a /cgi-bin directory within the website's directory structure.  A Perl script to display the date might then look something like:

#!/usr/bin/perl -w

use strict;
use CGI;

my $q = new CGI();

print $q->header();
print gmtime;

I don't know the specifics of setting tomcat up for Perl I'm afraid.  You'll have to go look it up.
0
 
LVL 3

Assisted Solution

by:rkosai
rkosai earned 125 total points
ID: 9893221
>  Hi I have developed web applications using JAVA , JSP . but never into cgi  programming for dynamic content.

JSP is a form of CGI programming.  Using the Tomcat server, you use Java to create web content.  CGI only stands for common gateway interface, and is not language specific.

However, when a web hosting company says they have CGI scripting support, they usually mean that they have Perl CGI support.  You don't have to do any set up for this support, simply load the scripts into a cgi-bin directory (or even in the main web directory for some hosting companies), and change the permissions so that the files have "Execute" permissions (755 tends to be the one I use).

If you want to set up your own CGI-Perl scripting environment, even under a Windows server, it is usually easiest to set up Apache.  Tomcat is a Java servlet container not related to Perl/CGI content, so you'll just be using Perl to run the scripts.  You can download a good windows version of Perl from www.activestate.com (It is called ActivePerl).  This does not require Unix or any Unix-like system (including Cygwin).
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now