Chapter 11
An example of a CGI project that wouldn't make an ideal module might be a 
search application. Typically search functionality is tightly integrated into the 
underlying data and user interface of a Web site. It may still be possible to solve 
this problem with CGI::Application, but the results are unlikely to be usable on 
other sites.
Configurability
The primary goal of a successful CGI::Application module on CPAN has to be con 
figurability. These applications will live in a varied environment, and their mode of 
operation has to be flexible. For example, the CGI::Application::MailPage module,
6
which provides a  mail this page to a friend  application for static HTML documents, 
is configurable in how it sends mail, what options it offers to its users, and how it 
accesses the underlying documents. For example, here's a typical instance script 
used with CGI::Application::MailPage:
#!/usr/bin/perl
use CGI::Application::MailPage;
my $mailpage = CGI::Application::MailPage >new(
                  PARAMS => { document_root  =>  /home/httpd ,
                              smtp_server    =>  smtp.foo.org ,
                              use_page_param => 1,
                            });
$mailpage >run();
Template Usage
All CGI::Application modules on CPAN will have to use templating of some sort to 
be widely reusable. Otherwise it would be impossible for the output of the module 
to be reconfigured to match the look of the site where it is being used. However, 
this doesn't mean that CGI::Application modules should require users to provide 
their own templates. The modules should come with a default set with simple 
HTML formatting. This serves two purposes. First, it provides an example for users 
to build off of. Second, it allows users to more easily evaluate the module and test 
its functionality.
One issue does arise in packaging default templates how will the module 
find them after installation? Perl doesn't (yet!) support a default template path, so 
you'll have to do something about it yourself. The technique I used in building 
6. I wrote CGI::Application::MailPage as a proof of concept in building a CGI::Application 
for CPAN.
270






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

web hosting perl

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved