App-Lazyd
view release on metacpan or search on metacpan
use strict;
use warnings;
use App::Lazyd;
use YAML::Tiny;
unless (-f "$ENV{HOME}/.lazyd") {
die <<USAGE;
Please add a ~/.lazyd config file looks like this
username: foo
password: foo31337
USAGE
}
my $yaml = YAML::Tiny->read("$ENV{HOME}/.lazyd");
my $ok = App::Lazyd->run($yaml->[0], @ARGV);
if ($ok) {
This program quicky post a bookmark to http://delicious.com with
automatically created tags. The tags are words found in the given URI
and its title.
First you need to setup a ~/.lazyd config file like this:
username: foobar
passsword: f00b4r
That's your delicious.com username and password.
Then you'll just need to run it like this:
% lazyd http://delicious.com/
And forget about tagging at all.
=head1 AUTHOR
Kang-min Liu E<lt>gugod@gugod.orgE<gt>
lib/App/Lazyd.pm view on Meta::CPAN
use warnings;
our $VERSION = '0.01';
use Net::Delicious;
use URI::Title qw( title );
sub run {
my (undef, $config, $url, @tags) = @_;
die "Need to set both username and password."
unless defined($config->{username}) && defined($config->{password});
die "You should give me an URL, dude.\n"
unless defined $url;
my $del = Net::Delicious->new({
user => $config->{username},
pswd => $config->{password}
});
my $title = title($url) || "";
$del->add_post({
url => $url,
tags => join(" ", @tags, split(/\W/, "$url $title")),
description => $url,
});
}
( run in 1.009 second using v1.01-cache-2.11-cpan-49f99fa48dc )