Oracle9iAS Portal Developer Kit
How to Build a PERL Portlet

PDK Release 2 (9.0.2 and later)

Once you have successfully installed and deployed the PDK, you may want to begin building PERL portlets of your own. The PDK enables you to create URL-based portlets that display content from PERL pages.

This article describes how to build a basic PERL portlet.

### ASSUMPTIONS

1. You have already gone over how to build a URL-based portlet by following the article, How to Build a URL-Based Portlet.

2. You are able to access your own PERL samples through a URL.

### BUILDING A PERL PAGE

Before building a PERL portlet, you must first build your own PERL page. You can follow these steps to get started.

1. Write a simple PERL sample that displays a welcome greeting along with the time and date. You may write your own or use the sample provided.

   > #C:/ORACLE/ISUITES/perl/5.00503/bin/MSWin32-x86/perl.exe ## ## printenv -- demo CGI program which just prints its environment ## print "Content-type: text/html\n\n"; print "<center><b><i><u><font size='7'>"; print "Hello World!\n"; print "</b></i></u></font></center><br><hr width=75%>"; print "<center><b><i><font size='6'><br>"; $a = "Welcome to the Perl portlet!\n"; print substr ($a, 0, 7); # "Welcome" print substr ($a, 7); # " to Perl!\n" print "<br><br>"; $mytime = localtime(); print $mytime; print "</b></i></font></center><br><hr width=75%>"; use CGI ':standard';

2. Save this file as myfirstperlportlet.pl.

3. Move the file to your PERL directory and make sure it is possible to display the PERL sample in the browser. For example: http://<yourservername:port>/perldirectory/myfirstperlportlet.pl

### BUILDING THE PERL PORTLET

At this point, you are ready to build your PERL portlet. The steps required to build the PERL portlet are the same steps as those described in the article, How to Build a URL-Based Portlet. Proceed by following all of the steps in that article, using http://<yourservername:port>/perldirectory/myfirstperlportlet.pl for the value of the pageUrl tag in the provider.xml file. You should then be able to deploy and register your PERL portlet in the exact same manner as the Google.com portlet described in the How to Build a URL-Based Portlet article.

### NEXT STEPS

The following articles show you how to enhance the user interface of a URL-based portlet:

- How to Build a URL-Based Portlet that Uses HTML Filtering
- How to Build a URL-Based Portlet with Inline Rendering of Portlet Links

The following articles show you how to enhance the security of a URL-based portlet:

- How to Build a URL-Based Portlet with Single Sign-On to an External Application
- How to Build a URL-Based Portlet with Single Sign-On to an Application Using Basic Authentication

Revision History:

- March 2002

- June 2002