#-*-Perl-*-

#Tack on the names of the subroutines to the list of functions
$hof{"doodie"} = 0;

sub doodie {
    my $today = shift;
    my @ltime = gmtime($today);
    my $date = strftime("%Y%m%d",@ltime);
    #exception list last updated Jan 23, 2002, but have only checked back
    #to Dec. 25, 2000.
    my @missing = (19991220,20000124,20000125,20000126,20000218,20000315,
		   20000518,20001123,20001214,20001222,20001225,20010101,
		   20010117,20010125,20010202,20010329,20010504,20010626,
		   20010919,20011109,20011112,20020115,20020306
		   );
    my %fix_cdate = (19990930 => "10031999",
		     20010426 => "04362001",
		     );
    return undef if (($date < 19990821) || #first comic Aug 21, 1999
		     #none if after Sep 17, 1999 and is Saturday or Sunday 
		     ($date > 19990917 && $ltime[6] =~ /[06]/) ||
		     grep(/$date/, @missing)); 
    my $cdate = (defined $fix_cdate{$date}) ? $fix_cdate{$date} : undef;
    $date = strftime("%m%d%Y",@ltime); #reformat for use in URLs
    $cdate = $date unless defined $cdate;
    my $urlbase = "http://www.doodie.com/";
    my %rec = ('title' => "Doodie",
	       'author' => "Tom Winkler",
	       'type' => "gif",
	       'main' => $urlbase,
	       'base' => $urlbase,
	       'page' => "index.php?date=$date",
	       'exprs' => {
		   'comic' => ["(pics/[^\"]+\\.gif\\.$cdate)"],
		   'caption' => ["gif\\.$cdate.*?(<pre.*?</pre>)"],
	       },
	       );
    return \%rec;
}

1;
