(from datetime list)
DateTime::Span::Birthdate 0.01 is now going to CPAN.
This module is a port of Date::Range::Birth, which allows you to build a range of dates for birthdays of people with particular age. This makes it easy for you to build an SQL query for example, to select teenager users from your database which has 'birth' column as datetime.
# build a datetime span for teenagers use DateTime::Span::Birthdate; my $span = DateTime::Span::Birthdate->new(from => 13, to => 19);
# build an SQL query in a raw way my $sql = "SELECT * FROM user WHERE birthday >= ? AND birthdy <= ?"
my $sth = $dbh->prepare($sql); $sth->execute($span->start->ymd, $span->end->ymd);