Net::Delicious errors

I don’t like apologising for a post right at the start, but I must admit that this will probably be of no interest to most of you. But I’m a bit stuck with some perl and if nothing else, finding a solution might help someone else who Googles for the error messages, something I’ve had little luck with.

For the past three years I’ve been using a perl script to grab my daily links and post them to this Movable Type weblog. (I know can do this for you but I don’t like the way it includes every link’s tags, or the way it uses an unordered HTML list, rather than a definition list. I’m picky.)

During my recent upgrade to Movable Type 4 I noticed that the Net::Delicious perl module was generating errors and failing. I’m not quite sure when they started, but I can’t get the script working again.

The first error is:

"my" variable $root masks earlier declaration in same scope at /Users/phil/Sites/cgi-bin/ line 1030.

My semi-tutored eye can immediately see the problem, and remove the “my” from line 1030, although I’m not sure how this got into the released version of the module.

The second error is:

Use of uninitialized value in -f at /Users/phil/Sites/cgi-bin/ line 227.

I’m stumped by this and have no idea what it’s complaining about or how to fix it. Any ideas? This is the script I’m using to test:

#!/usr/bin/perl -w

use strict;
use lib "/Users/phil/Sites/cgi-bin/";
use Net::Delicious;
use Log::Dispatch::Screen;

# Initialise Delicious stuff.
my $del = Net::Delicious->new({
    user   => 'username',
    pswd   => 'password'

(Obviously, with the correct username and password; I’ve checked them.)

Many thanks, even if you point out something really stupid I’m doing.


  • Both of these seem to be bugs in the module that only appear if you run using warnings, as you do. The first you've got, but the second is a bit tricksier. The error

            elsif (-f $args->{cfg}) {


            elsif ($args->{cfg} && -f $args->{cfg}) {

    suppresses the warning without changing the flow of the code (I believe).

    You should probably file a bug report, and/or check there isn't one already. One option is to use, but I know some module authors (and bug reporters) dislike the interface. Another is to email the author directly, which may work better in this case. In either case, ideally you'd provide a diff, like this. (Unfortunately your allowed tags include neither pre not tt. Oh well.)

    @@ -233,7 +233,7 @@
    $cfg = $args->{cfg};

    - elsif (-f $args->{cfg}) {
    + elsif ($args->{cfg} && -f $args->{cfg}) {
    eval {
    require Config::Simple;
    $cfg = Config::Simple->new($args->{cfg});
    @@ -1027,7 +1027,7 @@

    - my $root = $self->{'__updates'};
    + $root = $self->{'__updates'};
    return File::Spec->catfile($root, $file);

  • Wow, perfect, many thanks Paul!

    I've also added pre to the list of allowed tags and added them to your comment in what I hope is an appropriate manner. Cheers.

    (And possibly broken comment submission slightly in the process... to be fixed tomorrow.)

Commenting is disabled on posts once they’re 30 days old.

Wednesday 24 October 2007, 4:24pm

< PreviousIn all of WritingNext >

24 Oct 2007 at Twitter

  • 10:10pm: Shaving a yak before bedtime.
  • 3:44pm: Sweating, after cleaning the flat.