[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] noCPAN coding
If you can't use CPAN at all (gasp!) how do you detect if $record year/month is more than 7 years ago? I've been using Class::Date and/or DateTime *forever* so this was quite a trip down memory lane today:
my @localtime = localtime(time);
my $cutoff_mon = sprintf("%02d", $localtime[4] + 1);
my $cutoff_year = $localtime[5] + 1900 - 7; # 7 years ago
my $disabled;
if ($record->{"DateLastSeen"}{"Year"} . $record->{"DateLastSeen"}{"Month"} lt "$cutoff_year$cutoff_mon") {
$disabled = "DISABLED";
}
:)
Jay Hannah
Software Architect
jhannah@mutationgrid.com | http://mutationgrid.com | 1-402-598-7782