#!/usr/bin/perl
use strict;
use Net::Delicious;
use DateTime;
use DateTime::TimeZone;
my $blosxom_data = "/path/to/blosxom/data/daily_links/";
my $timezone = "Australia/Sydney";
my $time_local = DateTime->now;
my $time = $time_local->clone()->set_time_zone($timezone);
my $time_gmt = $time_local->clone()->set_time_zone('GMT');
my $time_day = $time->strftime("%G-%m-%d");
my $time_gmt_day = $time_gmt->strftime("%G-%m-%d");
my $time_day_readable = $time->strftime("%B %d, %Y");
my $i = 0;
my $delicious = Net::Delicious->new({ user => "username",
pswd => "password" });
die "Unable to connect to del.icio.us.\n" unless $delicious;
my @posts = $delicious->posts( { dt => $time_gmt_day } );
$i = @posts;
if ( $i ) {
my $output_file = $blosxom_data . $time_day . ".txt";
open OUTPUT, '>', $output_file;
print OUTPUT "Links of the Day: $time_day_readable\n\n";
while ( $i ) {
$i--;
my ( $href, $description, $extended ) =
( $posts[$i]->href, $posts[$i]->description, $posts[$i]->extended );
print OUTPUT "$description
\n";
print OUTPUT "$extended
\n
\n"
}
close OUTPUT;
}