[Omaha.pm] noCPAN coding

Jay Hannah jhannah at mutationgrid.com
Mon Nov 22 12:33:38 PST 2010


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 at mutationgrid.com | http://mutationgrid.com | 1-402-598-7782










More information about the Omaha-pm mailing list