Changeset 1944

Show
Ignore:
Timestamp:
04/22/07 23:23:54
Author:
otsune
Message:

use template. add interval.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Publish/Twitter.pm

    r1943 r1944  
    55use Encode; 
    66use Net::Twitter; 
     7use Time::HiRes qw(sleep); 
    78 
    89sub register { 
     
    3031    my($self, $context, $args) = @_; 
    3132 
    32     my $body = ( $args->{entry}->summary->plaintext || $args->{entry}->title ) . " " . $args->{entry}->permalink
     33    my $body = $self->templatize('twitter.tt', $args)
    3334    # TODO: FIX when Summary configurable. 
    3435    if ( length($body) > 159 ) { 
     
    3738    $context->log(info => "Updating Twitter status to '$body'"); 
    3839    $self->{twitter}->update( encode_utf8($body) ) or $context->error("Can't update twitter status"); 
     40 
     41    my $sleeping_time = $self->conf->{interval} || 15; 
     42    $context->log(info => "sleep $sleeping_time."); 
     43    sleep( $sleeping_time ); 
    3944} 
    4045 
     
    6974Twitter password. Required. 
    7075 
     76=item interval 
     77 
     78Optional. 
     79 
    7180=item apiurl 
    7281