#-*-Perl-*-

$hof{"pa"} = 0;

# Penny Arcade
# http://www.penny-arcade.com/

#Design:
#
#First use a function to determine if the specified date exists,
#then have it return just a hash to update the rli with the correct info.

sub pa {
    my $time = shift;
    return undef if $time < mkgmtime(0,0,0,18,10,98); #first comic Nov. 18, 1998
    my @ltime = gmtime($time);
    my $date = strftime("%Y-%m-%d", @ltime);
    my $date2 = strftime("%Y%m%d", @ltime);
    my $date3 = strftime("%m/%d/%Y", @ltime);
    my $year = strftime("%Y", @ltime);
    my $baseurl = "http://www.penny-arcade.com";
    my $rec = {
	'title' => "Penny Arcade",
	'author' => "Mike Krahulik and Jerry Holkins",
	'main' => $baseurl,
	'archives' => "$baseurl/view.php3",
	'base' => "$baseurl/",
	'page' => "view.php3",
	'func' => sub {
	    $_ = shift;
	    my @relurls = ();
	    if (/"(view\.php3\?date=$date)">$date3 (.*)<\/option>/) {
		push @relurls, {
		    'caption' => $2,
		    'page' => $1,
		    'exprs' => {
                'comic' => ["img src=\"(images/$year/$date2\.+?((jpg|gif|png)))\""],
                'type' => ["img src=\"images/$year/$date2\.+?(jpg|gif|png)\""],
            },
            'func' => undef,   
		};
	    }
	    return @relurls;
	},
    };
    return $rec;
}

1;
