Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

new to cgi

Posted on 2003-12-03
6
Medium Priority
?
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

688 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