#-*-CPerl-*-
foreach (qw(boxjam heaven framed stereo rocr fce sketch fatjc roses 
  zap spork tang ais forbez tap chopping oddjobs miracle ua)) {
  $hof{$_} = 0;
};
foreach (qw(attwf)) {
  $hof{$_} = 365;
};

# keenspace
sub keenspace {
    my ($title,$author,$date,$url) = @_;
    if ($url =~ /http:\/\//) {$baseurl = $url;}
    else {$baseurl = "http://$url.keenspace.com";}
    my @ltime2 = gmtime(time);
    
    my $page = "/d/$date.html";
    if ($date == strftime("%Y%m%d",@ltime2)) {
        $page = "/index.html";
    }
    
    
    my $rec = {
        'title' => "$title",
        'author' => "$author",
        'main' => $baseurl,
        'archives' => $baseurl,
        'base' => $baseurl,
        'page' => $page,
    };

    #heaven and Earth, Rogues of Clwyd-Rhan, Sketch of Love 
    #do not always stick to one image per comic each day
    #No Sterotypes has multiple images often usually Sundays
    $rec->{'func'} = sub {
 	 my $text = shift;
     my @relurls = ();
  	  #repeatedly match and replace.  
          while (1) {
            if ($text =~ s/src=".*?(\/comics\/.*?$date\w?\.((:?jpg)|(:?gif)|(:?png)))"\s+?width="(\d+?)"\s+?height="(\d+?)"//i) {
              push(@relurls,$1);
              $rec->{'type'} = $2;
              $rec->{'size'} = [$6,$7];
            } elsif ($text =~ s/src=".*?(\/comics\/.*?$date\w?\.((:?jpg)|(:?gif)|(:?png)))"//i) {
              push(@relurls,$1);
              $rec->{'type'} = $2;
            } else {
              last;
            }
          }
	  if ($text =~ s/selected>(.*?)<\/option>//i) {
        $rec->{'caption'} = $1;
      }
      return reverse @relurls;
    };
    return $rec;
}

#Arrogance in Simplicity
sub ais {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list 
    #last updated MAy 18, 2001
    my @missing = (20000212,20000213,20000214,20000215,20000216,20000217,
    20000218,20000219,20000221,20000222,20000224,20000225,20000226,
    20000228,20000229,20000301,20000302,20000303,20000304,20000305,
    20000306,20000307,20000308,20000309,20000310,20000311,20000312,
    20000313,20000314,20000315,20000316,20000317,20000318,20000319,
    20000321,20000322,20000323,20000324,20000325,20000326,20000327,
    20000330,20000505,20000506,20000507,20000508,20000509,20000510,
    20000827,20000828,20000829,20000830,20000831,20000901,20000902,
    20000903,20000904,20000905,20001212,20001214,20001216,20001218,
    20001220,20001222,20001224,20001226,20001228,20001229,20001231,
    20010101,20010103,20010104,20010106,20010107,20010109,20010110,
    20010112,20010113,20010114,20010116,20010117,20010202,20010203,
    20010204,20010205,20010206,20010208,20010209,20010210,20010211,
    20010212,20010213,20010214,20010215,20010216,20010217,20010218,
    20010221,20010223,20010224,20010225,20010226,20010227,20010228,
    20010301,20010302,20010303,20010304,20010305,20010306,20010307,
    20010308,20010309,20010310,20010312,20010313,20010315,20010316,
    20010317,20010318,20010504,20010507,20010509);
    my @extra = ();

    #Before Mar. 19, 2001, released every day except for some exceptions.
    #Afterwards, released almost always on Mon Wed Fri
    return undef 
      if (($date < 20000201) || #first comic on Feb 02, 2000      
         grep(/$date/,@missing) ||
         ($date > 20010318 && 
         $ltime[6] !~ /[135]/ && 
         !grep(/$date/,@extra)));

    my $title="Arrogance in Simplicity";
    my $author="Capheine";
    my $url = "http://www.shaftware.com";

    return keenspace($title,$author,$date,$url);

}

# And then there was Fred
sub attwf {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

   # Last updated May 18, 2001
    my @missing = (20001226,20001227,20001228,20001229,20001230,
      20001231,20010101,20010102,20010103,20010104,20010105,
      20010106,20010107,20010109,20010110,20010111,20010112,
      20010113,20010114,20010115,20010116,20010117,20010118,20010119);

    return undef
        if ($date < 20000828) || #first comic on Aug 28, 2000
         grep(/$date/,@missing) ||
         ($date > 20010206); #last comic on Feb 6, 2001

    my $title="And Then There Was Fred";
    my $author="Walter Retlaw";
    my $url = "fred";

    return keenspace($title,$author,$date,$url);
}

# Boxjam's Doodle
sub boxjam {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    # Last updated June 21, 2001
    my @missing = ();
    my @extra = ();

    #no comics on Sunday or Saturday
    return undef 
    if (($date < 19990422) || # First comic April 22, 1999
      grep(/$date/,@missing) ||
  	  ($ltime[6] =~ /[06]/ && !grep(/$date/,@extra)));

    my $title="Boxjams Doodle";
    my $author="Boxjam";
    my $url = "http://boxjamsdoodle.com";

    return keenspace($title,$author,$date,$url);
}

#Chopping Block
sub chopping {
    my $time = shift;
    my @ltime = gmtime($time);
    my @ltime2 = gmtime(time);
    my $date = strftime("%Y%m%d", @ltime);
    my $date2 = strftime("%Y%m%d", @ltime2);

    #exceptions list 
    #last updated August 2, 2001
    my @missing = (20000726,20000727,20000731,20000801);
    my @extra = ();

    #M to F until present
    return undef if 
      (($date < 20000725) || #first comic on July 25, 2000
      (($date >= 20000725 && $date <= $date2) &&
      ($ltime[6] !~ /[12345]/ && !grep(/$date/,@extra))) ||
      grep(/$date/,@missing));

    my $title="Chopping Block";
    my $author="Lee Adam Harold";
    my $url = "http://www.choppingblock.org";

    return keenspace($title,$author,$date,$url);

}

# Fat Jesus
# ex : http://fatjesus.keenspace.com/comics/fatjesus$date.type
sub fatjc {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #last updated June 13, 2001
    my @missing = 
	(20001004,20001005,20001006,20001007,20001008,20001009,20001010,
	 20001011,20001012,20001013,20001014,20001015,20001022,20001023,
	 20001024,20001025,20001026,20001027,20001028,20001029,20001030,
	 20001031,20001101,20001102,20001103,20001104,20001105,20001109,
	 20001110,20001111,20001117,20001118,20001119,20001121,20001124,
	 20001125,20001126,20001201,20001230,20001231,20010101,20010102,
	 20010103,20010105,20010103,20010105,20010107,20010108,20010109,
	 20010113,20010114,20010122,20010123,20010124,20010125,20010126,
	 20010128,20010304,20010314,20010320,20010321,20010331,20010403,
     20010404,20010405,20010406,20010408,20010409,20010410,20010411,
     20010412,20010413,20010416,20010417,20010419,20010420,20010421,
     20010422,20010424,20010425,20010426,20010428,20010429,20010430,
     20010503,20010504,20010505,20010506,20010507,20010508,20010509,
     20010510,20010511,20010513,20010514,20010515,20010516,20010517,
     20010518,20010519,20010520,20010522,20010523,20010524,20010525,
     20010526,20010527,20010528,20010529,20010530,20010531,20010601,
     20010602,20010603,20010604,20010605,20010606,20010607,20010608,
     20010609,20010610);

    #the origin series has a total of 39.  Since the first comic is on
    #Oct 3, 2000, the start of archive adjusted for the origin series is
    #Aug 25, 2000
    return undef
        if ($date < 20000825 || 
	    grep(/$date/,@missing));

    my $title="Fat Jesus";
    my $author="Mike Leffel";
    my $url = "fatjesus";

    
    if ($date < 20001003) {
  	  #origin series
	  #ex: http://fatjesus.keenspace.com/fj_origin01/ORIGIN_1_FJ001.gif
  	  my $series;
	  my $n;
      if ($url =~ /http:\/\//) {$baseurl = $url;}
      else {$baseurl = "http://$url.keenspace.com";}

      my $rec = {
        'title' => "$title",
        'author' => "$author",
        'main' => $baseurl,
        'archives' => $baseurl,
        'base' => $baseurl,
        'page' => "/d/$date.html",
      };
	  $rec->{'size'} = [566,415]; #series 2 & 3 size
	  #origin 1: aug 25 - Sep 2; 9 total
	  if ($date <= 20000902) {
	    $series = 1;
	    if ($date > 20000831) {
		  $n = $date - 20000893;
	    } else {
		  $n = $date - 20000824;
	    }
	    $rec->{'size'} = ($date == 20000825 ? [566,830] : [708,519]);
	  } elsif ($date <= 20000914) {
	    #origin #2: Sep 3 - 14; 12 total
	    $series = 2;
	    $n = $date - 20000902;
	  } else {
	    #origin #3: Sep 15 - Oct 2; 18 total
	    $series = 3;
	    if ($date < 20001001) {
		  $n = $date - 20000914;
	    } else {
		  $n = $date - 20000984;
	    }
	  }
	  $rec->{'caption'} = "Origin $series.$n";
	  $n = "0$n" if $n < 10;
	  $rec->{'type'} = 'gif';
	  $rec->{'page'} = "/fj_origin0$series/ORIGIN_${series}_FJ0$n.gif";
      return $rec;
    } else {
      # Normal Strips
      return keenspace($title,$author,$date,$url);
    }
}

#Fight, Cast, or Evade http://fightcastorevade.keenspace.com/
sub fce {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    # Last updated March 20, 2001
    my @missing = (0);
    my @extra = (20001210,20010401);

    #comics only on MWF
    return undef 
    if (($date < 20000731) || #first comic on July 31, 2000
      grep(/$date/,@missing) ||
  	  ($date < 20001104 && $ltime[6] =~ /[02356]/ && !grep(/$date/,@extra)) ||
      ($ltime[6] =~ /[0246]/ && !grep(/$date/,@extra)));


    return undef if ($date < 20000731); # First comic: 7/31/2000
    return undef if (($date <  20001202) && ($ltime[6] !~ m/[14]/));

    #exception list last updated Feb. 4, 2001
    return undef if (($date >= 20001202) && ($ltime[6] !~ m/[135]/) &&
		   ($date != 20001210)); #extra one

    my $title="Fight Cast Or Evade";
    my $author="Matt Trepal";
    my $url = "fightcastorevade";

    return keenspace($title,$author,$date,$url);
}

#Life on Forbez
sub forbez {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list 
    #last updated May 17, 2001
    my @missing = (20000829, 20000901, 20000905, 20000910, 20000916, 20000921,
	 20000927, 20001001, 20001014, 20001015, 20001016, 20001028,
	 20001029, 20001104, 20001105, 20001108, 20001109, 20001110,
	 20001111, 20001112, 20001113, 20001114, 20001116, 20001117,
	 20001118, 20001119, 20001120, 20001121, 20001122, 20001123,
	 20001124, 20001125, 20001126, 20001127, 20001128, 20001129,
	 20001130, 20001201, 20001202, 20001203, 20001205, 20001206,
	 20001209, 20001210, 20001212, 20001213, 20001214, 20001215,
	 20001216, 20001217, 20001219, 20001221, 20001222, 20001223,
	 20001224, 20001225, 20001226, 20001227, 20001228, 20001229,
	 20001230, 20001231, 20010101, 20010102, 20010103, 20010104,
	 20010105, 20010106, 20010107, 20010109, 20010111, 20010113,
	 20010114, 20010116, 20010118, 20010120, 20010121, 20010123,
	 20010125, 20010126, 20010127, 20010128, 20010130, 20010131,
	 20010201, 20010203, 20010204, 20010205, 20010206, 20010207,
	 20010208, 20010209, 20010210, 20010211, 20010212, 20010213,
	 20010215, 20010216, 20010217, 20010218, 20010219, 20010220,
	 20010221, 20010222, 20010223, 20010224, 20010225, 20010226,
	 20010227, 20010228, 20010301, 20010302, 20010303, 20010304,
	 20010305, 20010306, 20010307, 20010308, 20010309, 20010310,
	 20010311, 20010312, 20010313, 20010314, 20010315, 20010316,
	 20010317, 20010318, 20010413, 20010414, 20010415, 20010419, 
     20010420, 20010421, 20010422, 20010423, 20010424, 20010425, 
     20010426, 20010427, 20010428, 20010429, 20010505, 20010506, 
     20010509, 20010510, 20010512, 20010513, 20010516);

    return undef 
      if (($date < 20000803) || #first comic on Aug 03, 2000
         grep(/$date/,@missing));

    my $title="Life on  Forbez";
    my $author="Clarence D Cuasay";
    my $url = "cdc";

    return keenspace($title,$author,$date,$url);

}

# Framed
sub framed {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    # Last updated Feb. 7, 2002
    my @missing = (20001007,20001014,20001021,20001028,20001104,20001111,
				   20001118,20001125,20001202,20001209,20001216,20001230,
				   20010106,20010113,20010120,20010127,20010210,20010318,
				   20010324,20010331,20010512,20010513,20010519,20010520,
				   20010526,20010527,20010602,20010603,20010609,20010610,
				   20010616,20010617,20010623,20010624,20010630,20010701,
				   20010707,20010708,20010714,20010715,20010721,20010722,
				   20010729,20010925,20010926,20010927,20010928,20010929,
				   20010930,20011001,20011002,20011003,20011004,20011013,
				   20011020,20011027,20011103,20011110,20011117,20011124,
				   20011201,20011208,20011215,20011216,20011217,20011218,
				   20011219,20011221,20011223,20011227,20011228,20011229,
				   20011230,20020105,20020106,20020112,20020113,20020219,
				   20020120,20020121,20020122,20020123,20020124,20020125,
				   20020116,20020127,20020129,20020131,20020202,20020203,
				   20020204,20020205,20020206,20020207
				  );

    return undef
        if (($date < 20001003) || #first comic on Oct 03, 2000
          grep(/$date/,@missing));

    my $title="Framed";
    my $author="Damonk";
    my $url = "framed";

    return keenspace($title,$author,$date,$url);
}

# Heaven and Earth
sub heaven {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    # Last updated May 18, 2001
    my @missing = (20001227,20001229,20010307,20010309,20010312,
    20010314,20010316,20010319,20010321,20010323,20010328,20010330,
    20010402,20010404,20010409,20010411,20010413,20010416,20010418,
    20010420,20010507,20010509,20010511,20010514,20010516,20010518);
    my @extra = (0);

    #comics only on MWF
    return undef 
      if (($date < 20001225) || #first comic on Dec 25, 2000
      grep(/$date/,@missing)||
  	  ($ltime[6] =~ /[0246]/ && !grep(/$date/,@extra)));

    my $title="Heaven and Earth";
    my $author="Jon Sam";
    my $url = "nemo";

    return keenspace($title,$author,$date,$url);
}

# Mac Hall
sub machall {

	# Currently disabled:
	return undef;


	my $time = shift;
	my $time2 = time();
    my @ltime = gmtime($time);
	my @ltime2 = gmtime($time2);
    my $date = strftime("%Y%m%d", @ltime);
    my $date2 = strftime("%Y%m%d", @ltime2);

	# Your probably wondering why this is needed when I have a 'func' below.
	# Some days Ian just posts a rant in /plaintext/ which we can't get w/
	# the current netcomics methods. Therefore we need both a missing AND
	# a func.
    my @missing = (20010830,20010904,20010907,20010914,20011001,20011004,
				   20011008,20011009,20011017,20011018,20011026,20011029,
				   20011031,20011113);

    return undef 
      if (($date < 20001107) || #first comic on October 7, 2000.
          grep(/$date/,@missing));

    my $rec = {
        'title' => "Mac Hall",
        'author' => "Ian McConville",
        'main' => "http://machall.keenspace.com",
        'archives' => "http://machall.keenspace.com/archive.html",
        'base' => "http://machall.keenspace.com/",
        'page' => "archive.html",
		# As much as I'd love to use keenspace(), Mac Hall's release schedule
		# is so erratic that using a @missing list doesn't make any sense.
		# Besides, if I ever get my idea about archive lists implimented, this
		# won't be a problem.
		#
		# Since I'm going to be working up some of my favorite strips, which
		# don't come out on a regular schedule, I'm thinking of turning this
		# into keenspace2();
		'func' => sub {
			my $input_page = shift;
			my @relurls;
			# I am not at all happy about the following code.
			if (grep(/$date/, $input_page)) {
				my $page = strftime("d/%Y%m%d.html",@ltime);
				push(@relurls, {
								'page' => $page,
								'exprs' => {
											'comic'=>['(comics/\d+.jpg)'],
										   },
								'func' => undef
							   }
					);
			} else {
				# Okay. We now know that the date isn't in the archive page,
				# which can be misleading, Since keenspace's autogenerated 
				# archive pages list today's date as "today.html" instead of 
				# the easily grepable form of %Y%m%d.
				#
				# The obvious weakness in this is that there is no way to d/l
				# the most recent strip except for *on*the*day*of*posting*.
				# Otherwise, I'd have the regexp (comics/\d+.jpg), and this
				# would match the same strip *every*day* until the artist
				# updates.
				#
				# There should be a check in here somewhere to possibly 
				# reporcess the whole archive.html page, find the most
				# recent entry, and only allow downloading if
				# $today > $last_known_comic.
				push(@relurls, {
								'page' => "today.html",
								'exprs' => {
											'comic'=>["(comics\/$date.jpg)"],
										   },
								'func' => undef
							   }
					);
			};
			return @relurls;
		},
			  };
	

    return $rec;
}

#Makeshift Miracle
sub miracle {
    my $time = shift;
    my @ltime = gmtime($time);
    my @ltime2 = gmtime(time);
    my $date = strftime("%Y%m%d", @ltime);
    my $date2 = strftime("%Y%m%d", @ltime2);

    #exceptions list 
    #last updated Oct 23, 2001
    my @missing = ();
    my @extra = ();

    #MWF until present
    return undef if 
      (($date < 20010910) || #first comic on Sept 10, 2001
      (($date >= 20010910 && $date <= $date2) &&
      ($ltime[6] !~ /[135]/ && !grep(/$date/,@extra))) ||
      grep(/$date/,@missing));

    my $title="Makeshift Miracle";
    my $author="Jim Zubkavich";
    my $url = "miracle";

    return keenspace($title,$author,$date,$url);

}

#OddJobs
sub oddjobs {
    my $time = shift;
    my @ltime = gmtime($time);
    my @ltime2 = gmtime(time);
    my $date = strftime("%Y%m%d", @ltime);
    my $date2 = strftime("%Y%m%d", @ltime2);

    #exceptions list 
    #last updated Sept 25, 2001
    my @missing = (20010605,20010607,20010612,20010614,20010619,20010621);
    my @extra = (20010603);

    return undef if 
      (($date < 20000518) || #first comic on May 18, 2000
      (($date >= 20000518 && $date < 20001107) &&
      ($ltime[6] !~ /[4]/ && !grep(/$date/,@extra))) ||
      (($date >= 20001107 && $date < 20010625 ) &&
      ($ltime[6] !~ /[24]/ && !grep(/$date/,@extra))) ||
      (($date >= 20010625 && $date <= $date2) &&
      ($ltime[6] !~ /[135]/ && !grep(/$date/,@extra))) ||
      grep(/$date/,@missing));

    my $title="Oddjobs";
    my $author="Tim Broderick";
    my $url = "oddjobs";

    return keenspace($title,$author,$date,$url);

}

#Rogues of Clwyd-Rhan
sub rocr {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list developed from the archives page.
    #last updated May 18, 2001
    my @missing = (20000719,20000909,20000919,20000928,20000929,
        20001102,20001105,20001112,20001119,20001126,20001203,
        20001210,20001217,20001224,20010107,20010113,20010120,
        20010121,20010127,20010128,20010203,20010204,20010210,
        20010211,20010217,20010218,20010224,20010225,20010303,
        20010304,20010310,20010311,20010408,20010425,20010426,
        20010427,20010429,20010505,20010506,20010512,20010513);

    return undef 
      if (($date < 20000701) || #first comic on July 1, 2000
          ($date >= 20001001 && $date <= 20001031) || #a whole month
          grep(/$date/,@missing));

    my $title="Rogues of Clwyd-Rhan";
    my $author="Reinder Dijkhuis";
    my $url = "http://www.rocr.net";

    return keenspace($title,$author,$date,$url);

}

#Eat the Roses
sub roses {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list developed from the archives page.
    #last updated June 22, 2001
    my @missing = (20000621,20000623,20000625,20000627,20000629,
      20000701,20000702,20000703,20000704,20000705,20000706,
      20000707,20000708,20000709,20000710,20000711,20000712,
      20000713,20000715,20000717,20000719,20000721,20000723,
      20000725,20000727,20000729,20000731,20000801,20000802,
      20000803,20000804,20000805,20000806,20000807,20000808,
      20000809,20000810,20000811,20000812,20000813,20000815,
      20000817,20000819,20000821,20000823,20000825,20000827,
      20000829,20000831,20000901,20000902,20000903,20000904,
      20000905,20000906,20000907,20000908,20000909,20000910,
      20000911,20000912,20000913,20000914,20000915,20000916,
      20000917,20000919,20000921,20000923,20000925,20000927,
      20000929,20001001,20001002,20001003,20001004,20001005,
      20001006,20001007,20001008,20001009,20001010,20001011,
      20001012,20001013,20001015,20001017,20001019,20001021,
      20001023,20001025,20001027,20001029,20001031,20001101,
      20001102,20001103,20001104,20001105,20001106,20001107,
      20001108,20001109,20001110,20001111,20001112,20001113,
      20001114,20001115,20001116,20001117,20001118,20001119,
      20001120,20001121,20001122,20001123,20001124,20001125,
      20001205,20001228,20001230,20010101,20010103,20010111,
      20010120,20010121,20010127,20010128,20010203,20010204,
      20010211,20010216,20010217,20010218,20010221,20010224,
      20010225,20010301,20010302,20010303,20010304,20010310,
      20010311,20010325,20010330,20010331,20010405,20010407,
      20010408,20010613,20010627,20010629,20010720,20010730,
	  20010822,20010912,20010928,20011001,20011005,20011024,
	  );

    my @extra = (20010517,20010519,20010520,20010522,20010524,20010529,
      20010531,20010609,20010619,20010621);

    #Before april 08, 2001, released every day except for some exceptions.
    #Afterwards, released almost always on Mon Wed Fri
    return undef 
      if (($date < 20000618) || # First comic June 18, 2000
        grep(/$date/,@missing) ||
        ($date > 20010408 && 
        $ltime[6] !~ /[135]/ && 
        !grep(/$date/,@extra)));

    my $title="Eat The Roses";
    my $author="Meaghan Quinn";
    my $url = "eattheroses";

    return keenspace($title,$author,$date,$url);

}

#Sketch of Love http://sketchoflove.keenspace.com/
sub sketch {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d",@ltime);

    #exception tables last updated June 19, 2001
    my @missing = (20000924,20001008,20001009,20001021,20001105,
        20001112,20001113,20001119,20001125,20001208,20010207,
        20010209,20010307,20010328,20010330,20010409,20010411,
        20010413,20010416,20010423,20010507,20010509,20010511,
        20010518,20010523,20010604,20010608,20010611,20010613,
        20010618);

    my @extra = (20001207,20010410,20010424,20010508,20010510,
      20010614,20010619);

    #Before Nov. 25, 2000, released every day except for some exceptions.
    #Afterwards, released almost always on Mon Wed Fri
    return undef if
	  (($date < 20000902) || # First comic 2000-Sep-02
      grep(/$date/,@missing) ||
  	  ($date > 20001125 && 
       $ltime[6] !~ /[135]/ && 
       !grep(/$date/,@extra)));

    my $title="Sketch of Love";
    my $author="Shari Hes";
    my $url = "sketchoflove";

    return keenspace($title,$author,$date,$url);
}

#Sporkman
sub spork {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list developed from the archives page.
    #last updated May 18, 2001
    my @missing = ();
    my @extra = ();

    #changed to MWF on June 18, 2001
    return undef 
      if (($date < 20000131) || #first comic on Jan 31, 2000
        ($date > 20010618 && $ltime[6] !~ /[135]/ && !grep(/$date/,@extra)) ||
        grep(/$date/,@missing));

    my $title="Sporkman";
    my $author="John Troutman";
    my $url = "sporkman";

    return keenspace($title,$author,$date,$url);
}

# No Stereotypes
sub stereo {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    # Last updated May 18, 2001
    my @missing = (20010422,20010423,20010502,20010504,20010505,
    20010507,20010509,20010511,20010512,20010);

    return undef
        if (($date < 20001113) || #first comic on Nov 13, 2000
          grep(/$date/,@missing));

    my $title="No Sterotypes";
    my $author="Amber glych Greenlee";
    my $url = "glych";

    return keenspace($title,$author,$date,$url);
}

# Tang's Comics
sub tang {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list developed from the archives page.
    #last updated May 18, 2001
    my @missing = (19990627,19990516,19971109,19971103);
    my @extra = (19990629,19990518);

    return undef 
      if (($date < 19970707) || #first comic on July 07, 1997
         ($ltime[6] != 1 && $date <= 19971108) ||
         ($ltime[6] != 0 && $date > 19971109 && !grep(/$date/,@extra)) ||
          grep(/$date/,@missing));

    my $title="Tangs Comics";
    my $author="Tang Ho";
    my $url = "tang";

    return keenspace($title,$author,$date,$url);
}

#Todd and Penguin
sub tap {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list developed from the archives page.
    #last updated May 18, 2001
    my @missing = (20010114,20010127,20010128,20010203,20010210,
    20010211,20010318,20010324,20010331);

    my @extra = (20010513);

    #Before march 31, 2001, released every day except for some exceptions.
    #Afterwards, released almost always on Mon to Fri
    return undef 
      if (($date < 20001206) || #first comic on Dec 6, 2000
          grep(/$date/,@missing)  ||
          ($date > 20010331 && 
          $ltime[6] =~ /[06]/ && 
          !grep(/$date/,@extra)));
    	  

    my $title="Todd and Penguin";
    my $author="Dave Wright";
    my $url = "toddandpenguin";

    return keenspace($title,$author,$date,$url);

}

#Untitled Again
sub ua {
    my $time = shift;
    my @ltime = gmtime($time);
    my @ltime2 = gmtime(time);
    my $date = strftime("%Y%m%d", @ltime);
    my $date2 = strftime("%Y%m%d", @ltime2);

    #exceptions list 
    #last updated Oct 25, 2001
    my @missing = (20001009,20001011,20001012,20001013,20001017,20001018,
      20001019,20001020,20001024,20001025,20001026,20001027,20001030,
      20001101,20001102,20001107,20001108,20001114,20001115,20001117,
      20001121,20001122,2000124,20010623,20010630,20010914);
    my @extra = (20001007,20010118,20010121,20010505,20010913);

    #M to F scattered until November 27, 2000
    #MWF until June 1, 2001
    #MtoSa until July 1,2001
    #MWF until present
    return undef if 
      (($date < 20001003) || #first comic on October 3, 2000
      (($date >= 20001003 && $date < 20001127) &&
      ($ltime[6] !~ /[12345]/ && !grep(/$date/,@extra))) ||
      (($date >= 20001127 && $date < 20010601) &&
      ($ltime[6] !~ /[135]/ && !grep(/$date/,@extra))) ||
      (($date >= 20010601 && $date < 20010701) &&
      ($ltime[6] !~ /[123456]/ && !grep(/$date/,@extra))) ||
      (($date >= 20010701 && $date <= $date2) &&
      ($ltime[6] !~ /[135]/ && !grep(/$date/,@extra))) ||
      grep(/$date/,@missing));

    my $title="Untitled Again";
    my $author="Paul Roustan";
    my $url = "http://www.untitledagain.com";

    return keenspace($title,$author,$date,$url);

}

#Zap Jones
sub zap {
    my $time = shift;
    my @ltime = gmtime($time);
    my $date = strftime("%Y%m%d", @ltime);

    #exceptions list developed from the archives page.
    #last updated May 18, 2001
    my @missing = (20010108,20010109,20010110,20010111,20010112,
    20010115,20010116,20010117,20010118,20010119,20010122,20010123,
    20010124,20010125,20010126,20010320,20010326,20010327,20010328,
    20010329,20010330,20010515,20010516);

    my @extra = (20010107,20010311,20010324,20010407,20010512); 

    return undef 
      if (($date < 20010107) || #first comic on Jan 7, 2001
          grep(/$date/,@missing)  ||
    	  ($ltime[6] =~ /[06]/ && !grep(/$date/,@extra)));

    my $title="Zap Jones";
    my $author="Caleb Sevcik";
    my $url = "zapjones";

    return keenspace($title,$author,$date,$url);

}

1;
