Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
I should have Class::CGI::DateTime uploaded tomorrow. It was really simple to write. Here's the bulk of it:
package Class::CGI::DateTime;
use strict;
use warnings;
use DateTime;
sub new {
my ( $class, $cgi, $param ) = @_;
my $args = $cgi->args($param);
my @params = $args ? @$args : qw(day month year);
if ( 'date' ne $param ) {
@params = map {"$param.$_"} @params;
}
# original param name and param value (yuck)
my %args = map {/([[:word:]]+)$/; $1, $cgi->raw_param($_) } @params;
# untaint them puppies
while ( my ( $arg, $value ) = each %args ) {
if ( 'time_zone' eq $arg ) {
$value =~/^(floating|local|\+\d+|[[:word:]]+\/[[:word:]]+)$/;
$args{$arg} = $1;
}
else {
$value =~/^(\d+)$/;
$args{$arg} = $1;
}
}
return DateTime->new(%args);
}
1;
How many times do you see folks writing date handling code where they don't bother to untaint it? I see it quite a bit. The validation, by the way, is left to DateTime. It appears to return error messages more suitable for programmers than end users, though.
Data::FormValidator::Constraints::DateTime (Score:2)
Data::FormValidator::Constraints::DateTime [cpan.org]?
Re:Data::FormValidator::Constraints::DateTime (Score:2)
I am familiar with that. The intent of Class::CGI is to provide a mediator pattern which make the code easier to use and, as a nice side benefit, tends to impose a certain uniformity on form parameters while still providing flexibility. The basic use of the above could be: