Changeset 198
- Timestamp:
- 02/28/06 13:43:43
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/Publish/Delicious.pm
r186 r198 3 3 use base qw( Plagger::Plugin ); 4 4 5 use Encode; 5 6 use Net::Delicious; 6 use URI::Escape qw(uri_escape uri_escape_utf8);7 7 8 8 sub register { … … 24 24 25 25 sub add_entry { 26 my ($self, $context, $args) = @_;26 my($self, $context, $args) = @_; 27 27 28 28 my @tags = @{$args->{entry}->tags}; 29 29 my $tag_string; 30 30 if (scalar(@tags)) { 31 $tag_string = uri_escape_utf8( join ' ', @tags );31 $tag_string = join ' ', @tags; 32 32 } else { 33 33 $tag_string = ""; 34 34 } 35 35 36 $self->{delicious}->add_post({ 37 url => uri_escape( $args->{entry}->link ), 38 description => uri_escape_utf8( $args->{entry}->title ), 39 extended => uri_escape_utf8( $args->{entry}->body ), 40 tags => $tag_string, 41 }); 36 my $params = { 37 url => $args->{entry}->link, 38 description => encode('utf-8', $args->{entry}->title), 39 tags => encode('utf-8', $tag_string), 40 }; 42 41 43 my $sleeping_time = $context->conf->{interval} || 4; 42 if ($self->conf->{post_body}) { 43 $params->{extended} = encode('utf-8', $args->{entry}->body_text), 44 } 45 46 $self->{delicious}->add_post($params); 47 48 my $sleeping_time = $context->conf->{interval} || 3; 44 49 $context->log(info => "Post entry success. sleep $sleeping_time."); 45 50 sleep( $sleeping_time ); … … 61 66 password: your-password 62 67 interval: 2 68 post_body: 1 63 69 64 70 =head1 DESCRIPTION 65 71 66 72 This plugin posts feed updates to del.icio.us, using its REST API. 73 74 =head1 CONFIGURATION 75 76 =over 4 77 78 =item username, password 79 80 Your login and password for logging in del.icio.us. 81 82 =item interval 83 84 Interval (as seconds) to sleep after posting each bookmark. Defaults to 3. 85 86 =item post_body 87 88 A flag to post entry's body as extended field for del.icio.us. Defaults to 0. 89 90 =cut 67 91 68 92 =head1 AUTHOR
