#-*-Perl-*-
#color dilbert strips
#http://www.dilbert.com/comics/dilbert/color_strips/images/strips/dc/
#dc99083892822116389617919.gif
#  ^^         ^^^
#dc9904947509761011246.....gif
#  ^^          ^^^

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

sub dilbert {
    my @ltime = localtime(shift(@_));
    my $t_day = strftime("%Y%m%d",@ltime);
    my $n_day = strftime("%Y%m%d",localtime(time - 24*3600*7));
    my $get_color = ($t_day == $n_day && $ltime[6] > 0) ? 1 : 0;
    my %rec = ();
    $rec{'name'} = strftime("Dilbert-${date_fmt}.gif",@ltime);
    $rec{'base'} = "http://www.dilbert.com/comics/dilbert/";

    unless ($get_color) {
	#normal strip location for previous days
	$rec{'base'} .= "archive/";
	$rec{'page'} = strftime("dilbert%y%m%d.html",@ltime);
	$rec{'exprs'} = 
	    ["\/comics\/dilbert\/archive\/(images\/dilbert\\d+\.gif)"];
    } else {
	#color strip location for Monday-Saturday
	$rec{'base'} .= "color_strips/";
	$rec{'page'} = "";
	$rec{'exprs'} = [sprintf(strftime("(images\\/strips\\/dc\\/dc%y\\d+%%d%d\\d+\\.gif)",
					  @ltime),
				 $ltime[4]+1)];
    }
    return \%rec;
}

1;
