Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Apache::ASP -- CGI Migration

July 17, 2000

As we crowed about earlier, one of the luxuries of Apache::ASP is that we can quickly and easily integrate existing CGI-based Perl scripts into new (or old) HTML templates. How easily? Imagine we have a Perl script, newnews.cgi, that retrieves the newest news article from a database of articles. We won't worry about the details of this Perl script, except to say that it output only the article text without surrounding decoration. Now, with Apache::ASP installed, we want to integrate the newest news article into an elaborate HTML page, so that the article appears within a specific portion of the page.

newspage.asp

<HTML>
<HEAD><TITLE>The Newest News of the Day</TITLE></HEAD>
<BODY>
<!-- blah blah blah ... -->
<TABLE WIDTH='80%'>
 <TR>
   <TD WIDTH='20%'>
	<!-- lefthand column of table code -->
   </TD>
   <TD WIDTH='80%'>
	<!-- righthand column of table, 
	where Perl-generated news article will appear -->
	<% do "/www/htdocs/cgi-bin/newnews.cgi" %>
  </TD>
 </TR>
</TABLE></BODY></HTML>

How easy was that? The opening tag <% denotes the start of an ASP section. In this ASP section, all we do is call an external script, whose results will appear in this spot in the web page. The ASP section is closed with the %> tag. The ASP module, which handles this page, knows to pass any CGI parameters into the environment. So, if we wanted to send some parameters to newnews.cgi, we can simply send those parameters to newspage.asp, via either the GET or POST methods. For example, a "GET" form submission that yielded:

newspage.asp?date=071100

Would pass the date parameter into the CGI environment, and any included scripts, such as newnews.cgi, will transparently access this CGI parameter through the CGI.pm module. This is why no changes need be made to the original CGI script.

Apache::ASP -- Setup
The Perl You Need to Know
Apache::ASP -- Ebony and Ivory Living Together in Harmony


Up to => Home / Authoring / Languages / Perl / PerlfortheWeb




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers