>
> ExpireForm-0.0.1 intends to expire HTML form submissions, not html pages.
> The issue it addresses for CGI::Application is run-modes that return other
> run-modes. These sometimes misbehave if re-submitted, and ExpireForm uses a
> UID to ensure that no unique form is submitted more than once
> unintentionally.
After reviewing the POD (pasted below for easy browsing), this does look
a useful module for helping prevent duplicate form submissions.
There is already an easy solution for the case where you are checking
for duplicate inserts into a database-- pre-selecting the unique
identifier and then checking for duplicate unique keys. This will help
with other cases. I like that it offers options to use different
backends, such as CSV, Postgres or MySQL.
I could easily see this being used in conjunction with CGI::App. The
next step will be to actually try it. :)
-mark
http://mark.stosberg.com/
#####################
NAME
ExpireForm - Perl extension for preventing duplicate web form submition
SYNOPSIS
use ExpireForm;
my $ef = ExpireForm->new(driver=>'CSV', options=>suppressed);
# on the form building part of you scripts
print start_form(), textfield('name'), $ef->form_expirer,
submit(), end_form();
# then do the check on the form processing part of your scripts
my $fid = param('FID');
if ($ef->form_found($fid) && $ef->form_not_submitted($fid)) {
my_save_form() && $ef->mark_as_sent($fid);
} else {
print p('this form has already expired!');
}
DESCRIPTION
ExpireForm is a backend independant form submition control module, in
other words, it's just a way to avoid the multiple submitting of a form
due to the relentless use of the reload button.
METHODS
new()
my $ef = ExpireForm->new (driver=>$driver, options=>suppressed [,
field=>$field])
This method creates the ExpireForm Object, the options are:
driver The current options are: 'MySQL', 'Pg', 'CSV' or 'ColonSV'
(you don't want this one, use 'CSV' instead), just take your
pick depending on which driver you intend to use.
options These are driver specific options, check the ExpireForm::*
modules to see what you should pass to them.
field This sets the name of the hidden field to be generated. If
you don't pass a field name then the default name 'FID' is
used.
id_generator()
$ef->id_generator(\&custom_sub)
This sets a custom subrutine as the ID Generator, this ID is used to
distinguish one form from another, that is in case you don't want to
use the built in ID Generator.
form_expirer()
$ef->form_expirer()
This method returns a string with the hidden input field to be used
for marking a form as unique. Print or concatenate the return value
as needed.
mark_as_sent()
$ef->mark_as_sent($fid)
This method marks a form as submitted, it returns true on success,
undef otherwise. You must provide the form ID.
form_not_submitted()
$ef->form_not_submitted($fid)
This method returns true if a form isn't marked as submitted, undef
otherwise. You must provide the form ID.
form_found()
$ef->form_found($fid)
This method returns true if a form ID exists in the database, undef
otherwise. You must provide the form ID.
EXTENDING ExpireForm
Extending ExpireForm should be easy, you just have to write a new driver
class, the only requirements are that your driver class must be named
ExpireForm::Whatever and it should provide at least the following
methods (with the conventions detailed above):
new()
form_found()
save_id()
mark_as_sent()
form_not_submitted()
create_schema()
drop_schema()
The methods create_schema and drop_schema are not required, but highly
recommended, they are described on the ExpireForm::* Modules.
For using any database dependant methods, please make sure you have the
right permission to manipulate or retrieve data from the database.
BUGS
Probably some, report one and recieve a thanks e-mail from me!
SEE ALSO
ExpireForm::Pg, ExpireForm::MySQL, ExpireForm::CSV, ExpireForm::ColonSV
AUTHOR
Juan Jose Natera Abreu, <suppressed>
COPYRIGHT AND LICENSE
Copyright 2002 by Juan Jose Natera Abreu
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.