Apache-iNcom
view release on metacpan or search on metacpan
* lib/Apache/iNcom/Request.pm:
(cleanup_aliases) Undef the symbol of %Session and %UserSession,
since a %hash = undef call CLEAR in tied implementation.
* lib/Apache/iNcom/SessionLocker.pm: LockManager to serialize
access to session. It will be used only if
INCOM_SESSION_SERIALIZE_ACCESS is set to true.
* lib/Apache/iNcom.pm:
(session_init): Make sure the cookies' value looks like a
session id. Added Serialize parameter.
(new_session_handler) Added Serialize parameter.
(pod) Documented INCOM_SESSION_SERIALIZE_ACCESS directive.
2000-03-29 Francis J. Lacoste <francis.lacoste@iNsu.COM>
* lib/HTML/FormValidator.pm:
(filter_phone) Strip blank space.
* lib/Apache/iNcom/Request.pm:
(DESTROY): Disconnect from the database if we opened the connection
in the constructor.
(sql_do): Query isn't checked for INSERT|UPDATE|DELETE.
(record_search,template_search): Renamed incom_* parameters to
dbix_sp_*.
(pod): Started module documentation.
* lib/HTML/FormValidator.pm (new): The input profiles
specification can be passed directly to the constructor instead of
a file name.
(validate): If the constraints string looks like a regexp compile an
anonymous subroutines which match that regexp.
(postcode): Allow space or dash inside the postal code.
(filter_trim,filter_strip): Moved white space stripping code in
its own filter.
(pod): Added module documentation.
* lib/Apache/Session/DBIUUStore.pm (new): Renamed parameters to
DataSource, UserName, Password for DBIStore compatibility.
(DESTROY): If the database handle was opened by the module,
disconnect the connection on DESTROY to prevent spurious warnings.
lib/Apache/iNcom.pm view on Meta::CPAN
my %session;
# Check if there is a session id in the cookies
my $cookies = $r->pnotes( "INCOM_COOKIES" );
if ( $cookies->{INCOM_SESSION} ) {
my $session_id = $cookies->{INCOM_SESSION}->value;
# Load the user's session
eval {
# Make sure it looks like a session id
die "Invalid session id: $session_id\n"
unless length $session_id == 32 &&
$session_id =~ tr/a-fA-F0-9/a-fA-F0-9/ == 32;
tie %session, 'Apache::iNcom::Session', $session_id,
{ dbh => $r->pnotes( "INCOM_DBH"),
Serialize => $r->dir_config( "INCOM_SESSION_SERIALIZE_ACCESS" ),
};
# Save the session for future handlers
lib/HTML/FormValidator.pm view on Meta::CPAN
=head1 DESCRIPTION
HTML::FormValidator's main aim is to make the tedious coding of input
validation expressible in a simple format and to let the programmer focus
on more interesting task.
When you are coding web application one of the most tedious though
crucial task is to validate user's input (usually submitted by way of
an HTML form). You have to check that each required fields is present
and that some feed have valid data. (Does the phone input looks like a
phone number ? Is that a plausible email address ? Is the YY state
valid ? etc.) For simple form, this is not really a problem but as
forms get more complex and you code more of them this task became
really boring and tedious.
HTML::FormValidator lets you defines profiles which defines the
required fields and their format. When you are ready to validate the
user's input, you tell HTML::FormValidator the profile to apply to the
user data and you get the valid fields, the name of the fields which
are missing, the name of the fields that contains invalid input and
lib/HTML/FormValidator.pm view on Meta::CPAN
sub valid_zip {
my $val = shift;
return $val =~ /^\s*\d{5}(?:[-]\d{4})?\s*$/;
}
=pod
=item phone
This one checks if the input looks like a phone number, (if it
contains at least 6 digits.)
=cut
sub valid_phone {
my $val = shift;
return $val =~ tr/0-9// >= 6;
}
( run in 0.550 second using v1.01-cache-2.11-cpan-64827b87656 )