Re: [ANNOUNCE] Apache::FillInForm

2002-03-17 Thread Mark Maunder

Why not just use HTML::FillInForm?

Maurice Aubrey wrote:

 http://www.creation.com/~maurice/Apache-FillInForm-0.01.tar.gz
 I'll put it on CPAN if there's interest.

 NAME
 Apache::FillInForm - mod_perl interface to HTML::FillInForm

 SYNOPSIS
 httpd.conf:

   PerlModule Apache::Filter
   PerlModule Apache::FillInForm
   FilesMatch \.foo$
 PerlSetVar Filter on
 PerlHandler Apache::RegistryFilter Apache::FillInForm
   /FilesMatch

 And then somewhere in your application:

   use Apache::FillInForm;
   Apache::FillInForm-fill; # We have a form to fill out

 DESCRIPTION
 This is a mod_perl filter that uses HTML::FillInForm and Apache::Request
 to automatically populate forms with user submitted data.

 Your application should call Apache::FillInForm-fill to indicate that
 you need a form filled in. If you don't do that, the filter passes the
 content through unmodified to minimize the performance hit for pages
 with no forms. Regardless of how many times you call
 Apache::FillInForm-fill, your content will only be filtered once per
 request.

 The data source for the forms is taken from Apache::Request by calling
 its instance() method. If you're unfamiliar with how the instance()
 method works, see the Apache::Request documentation.

 If you don't want to use Apache::Request you should be able to subclass
 this module and override its data() method. The data() method should
 return either a hash reference or an object that has a CGI.pm-style
 param() interface.

 BUGS
 May want to allow specific forms to be targeted by name and use separate
 data sources for each.

 Warning: This interface is experimental and may change based on
 experience and feedback.

 AUTHOR
 Copyright 2002, Maurice Aubrey [EMAIL PROTECTED]. All rights
 reserved.

 This module is free software; you may redistribute it and/or modify it
 under the same terms as Perl itself.

 SEE ALSO
 perl(1), mod_perl(3), Apache(3), Apache::Filter(3), HTML::FillInForm(3),
 Apache::Request(3)




Re: [ANNOUNCE] Apache::FillInForm

2002-03-17 Thread Ade Olonoh

 httpd.conf:
 
   PerlModule Apache::Filter
   PerlModule Apache::FillInForm
   FilesMatch \.foo$
 PerlSetVar Filter on
 PerlHandler Apache::RegistryFilter Apache::FillInForm
   /FilesMatch
 
 And then somewhere in your application:
 
   use Apache::FillInForm;
   Apache::FillInForm-fill; # We have a form to fill out


Excuse my ignorance, but I'm a bit confused.  From this example, would
test.foo be an HTML file, or a Perl program?  

If the former, in what what application would you call fill()?  

If the latter, is the Apache conf to tell Apache::Filter to fill in
whatever form it finds in the Perl program's output?


--Ade.





Re: [ANNOUNCE] Apache::FillInForm

2002-03-17 Thread Maurice Aubrey

On Sun, Mar 17, 2002 at 04:27:21PM +, Mark Maunder wrote:
 Why not just use HTML::FillInForm?
 Maurice Aubrey wrote:
  http://www.creation.com/~maurice/Apache-FillInForm-0.01.tar.gz

This is just a wrapper, similar to Apache::Clean, that makes it simpler
in certain situations.  If your content handler buffers its output and you can
pass it directly through HTML::FillInForm yourself then great.

Maurice



Re: [ANNOUNCE] Apache::FillInForm

2002-03-17 Thread Maurice Aubrey

On Sun, Mar 17, 2002 at 05:19:37PM -0500, Ade Olonoh wrote:
  httpd.conf:
  
PerlModule Apache::Filter
PerlModule Apache::FillInForm
FilesMatch \.foo$
  PerlSetVar Filter on
  PerlHandler Apache::RegistryFilter Apache::FillInForm
/FilesMatch
  
  And then somewhere in your application:
  
use Apache::FillInForm;
Apache::FillInForm-fill; # We have a form to fill out
 
 
 Excuse my ignorance, but I'm a bit confused.  From this example, would
 test.foo be an HTML file, or a Perl program?  

A perl program (e.g., a registry script, content handler,
templating system, etc.).

 If the former, in what what application would you call fill()?  
 
 If the latter, is the Apache conf to tell Apache::Filter to fill in
 whatever form it finds in the Perl program's output?

The apache conf just places it in the chain.  Calling Apache::FillInForm-fill
(in the perl code) is what activates the filter for a particular request.
  
It's equivalent to how Apache::ASP works.  If you set $Response-{FormFill} = 1
in a template, Apache::ASP filters the output through HTML::FillInForm.  This is
the same idea except it's largely decoupled from the content generation system.

Maurice