Changeset 1942

Show
Ignore:
Timestamp:
04/12/07 17:23:18
Author:
tokuhirom
Message:

Plugin::Twitter: you can set the different API URL/HOST, for Twitter Compatible API Services(e.g. Frepa, Caspeee)

Files:

Legend:

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

    r1934 r1942  
    1616sub initialize { 
    1717    my($self, $context) = @_; 
    18     $self->{twitter} = Net::Twitter->new
     18    my %opt =
    1919        username => $self->conf->{username}, 
    2020        password => $self->conf->{password}, 
    2121    ); 
     22    for my $key (qw/ apihost apiurl apirealm/) { 
     23        $opt{$key} = $self->conf->{$key} if $self->conf->{$key}; 
     24    } 
     25    $self->{twitter} = Net::Twitter->new(%opt); 
    2226} 
    2327 
     
    2731    my $body = ( $args->{entry}->summary || $args->{entry}->title ) . " " . $args->{entry}->permalink; 
    2832    $context->log(info => "Updating Twitter status to '$body'"); 
    29     $self->{twitter}->update($body)
     33    $self->{twitter}->update($body) or $context->error("Can't update twitter status")
    3034} 
    3135 
     
    6064Twitter password. Required. 
    6165 
     66=item apiurl 
     67 
     68OPTIONAL. The URL of the API for twitter.com. This defaults to "http://twitter.com/statuses" if not set. 
     69 
     70=item apihost 
     71 
     72=item apirealm 
     73 
     74Optional. 
     75If you do point to a different URL, you will also need to set "apihost" and "apirealm" so that the internal LWP can authenticate. 
     76 
     77    "apihost" defaults to "www.twitter.com:80". 
     78    "apirealm" defaults to "Twitter API". 
     79 
    6280=back 
    6381