Subject: | subtract a date from a non-date |
Get the following error when expire($username) :-
Can't subtract a date from a non-date at
/usr/lib/perl5/site_perl/5.8.8/Apache/Htpasswd/Perishable.pm line 59.
this patch fixes it:
--- Perishable.pm 2002-01-08 23:47:27.000000000 +0100
+++ /usr/lib/perl5/site_perl/5.8.8/Apache/Htpasswd/Perishable.pm
2010-10-25 11:54:31.000000000 +0200
@@ -4,6 +4,8 @@
use warnings;
use Apache::Htpasswd;
use Date::Simple qw(today);
+use Date::Parse;
+use Date::Format;
our @ISA = qw(Apache::Htpasswd);
@@ -56,7 +58,9 @@
unless(defined $days){
my $expires = $self->fetchInfo($login);
my $today = today();
- return $expires - $today;
+ my $result = sprintf("%d",(str2time($expires) - str2time($today)) /
(60*60*24));
+ return $result;
+
}
my $date = today();