Net::Delicious::Simple - Net::Delicious for backups


delicious-backup documentation Contained in the delicious-backup distribution.

Index


Code Index:

NAME

Top

Net::Delicious::Simple - Net::Delicious for backups

VERSION

Top

version 0.013

SYNOPSIS

Top

  use Net::Delicious::Simple;
  my $del = Net::Delicious->new(user => 'plki', pswd => 'secret');

  print "$_->{href}\n" for $del->all_posts;

DESCRIPTION

Top

If you want to do anything interesting with del.icio.us automation, you probably want Net::Delicious. It's good. This module is not. It's just here to return all of your tags or posts as a basic Perl data structure. This makes it very easy to store that structure using existing dumpers. In fact, it only exists to power delbackup, which dumps to YAML or Netscape::Bookmarks.

METHODS

Top

new

The constructor gets passed the same things as you'd pass to Net::Delicious. Basically, you need to pass user and pswd arguments, giving your login credentials.

tags

This returns all of your tags, in a list.

all_posts

This returns all of your posts, in a list. Every post is hash with the following keys: description, extended, href, tags, and datetime.

Tags is an arrayref, and datetime is in seconds-sicne-epoch, GMT.

SEE ALSO

Top

Net::Delicious

AUTHOR

Top

Ricardo SIGNES <rjbs@cpan.org>


delicious-backup documentation Contained in the delicious-backup distribution.
package Net::Delicious::Simple;
use strict;
use warnings;

use Config::Auto;
use Date::Parse;
use Net::Delicious;

our $VERSION = '0.013';

sub new {
	my ($class, $config) = @_;

	return unless my $del = Net::Delicious->new({
    %$config,
    updates => File::Temp::tempdir(CLEANUP => 1),
  });

	bless { del => $del } => $class;
}

sub tags { my @tags = map { $_->tag } (shift)->{del}->tags }

sub all_posts {
  my ($self) = @_;

  my @all_posts = $self->{del}->all_posts;

	my @posts = map {{
		description => $_->description,
		extended    => $_->extended,
		href        => $_->href,
		tags        => [ split /\s+/, $_->tags ],
		datetime    => str2time($_->time)
	}} @all_posts;
}

1;