#!/usr/bin/perl use Net::Delicious; my $delUser = "cameron"; my $delPW = "****"; my $count = 10; my $output_file = "/web/docs..."; # start/end each link with the following my $link_start = "

"; my $link_end = "

"; # start/end each tag with the following my $tag_start = "
"; my $tag_end = "
"; my $tag_sep = " / "; my $delic = Net::Delicious->new({ user => $delUser, pswd => $delPW }); # get recent posts from Net::Delicious my @posts = $delic->recent_posts({ count => $count }); if (@posts) { # all of the conversion takes place in post_to_link my @posts = map { post_to_link($_) } @posts; open OUT,">$output_file"; print OUT join("\n", @posts ); close OUT; } sub post_to_link { my ($post) = @_; my @tags = split(/ /, $post->tags); # handle the special case of VIA tags foreach my $tag (@tags) { if ($tag =~ /^via/) { my $site = 'http://' . substr($tag, index($tag, ":") + 1); $tag = "via"; } else { $tag = "$tag"; } } my $tags .= $tag_start . join($tag_sep, @tags) . $tag_end; # if there's an extended tag, add it as a title= my $title = $post->extended ? " title=\"" . $post->extended . "\"" : ""; my $link = $link_start . "href . "\"$title>" . $post->description . "$tags" . $link_end; return $link; }