#!/usr/bin/perl -T
use HTML::TagCloud;
use YAML qw(LoadFile);
use CGI qw/:standard/;
use strict;
use warnings;
my $base = 'http://del.icio.us/netcasper/netcasper';
my $tags = LoadFile ('delicious.yml');
my $tag_count = $tags->{tag_count};
my $update_date = $tags->{update_date};
my $next_update = $tags->{next_update};
my $title = "懒惰的程序员 ($tag_count->{netcasper})";
delete $tag_count->{netcasper};
my $cloud = HTML::TagCloud->new;
for my $tag (sort keys %$tag_count) {
$cloud->add($tag, "$base+$tag", $tag_count->{$tag});
}
print header(-type=>'text/html',
-charset=>'UTF-8'),
start_html(-title=>$title,
-style=>{-code=>$cloud->css},
-lang=>'zh-CN'),
h1(a({href=>$base}, $title)),
$cloud->html,
hr(),
p("上次更新:$update_date,下次更新:$next_update。"),
end_html;