Changeset 1942
- Timestamp:
- 04/12/07 17:23:18
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/Publish/Twitter.pm
r1934 r1942 16 16 sub initialize { 17 17 my($self, $context) = @_; 18 $self->{twitter} = Net::Twitter->new(18 my %opt = ( 19 19 username => $self->conf->{username}, 20 20 password => $self->conf->{password}, 21 21 ); 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); 22 26 } 23 27 … … 27 31 my $body = ( $args->{entry}->summary || $args->{entry}->title ) . " " . $args->{entry}->permalink; 28 32 $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"); 30 34 } 31 35 … … 60 64 Twitter password. Required. 61 65 66 =item apiurl 67 68 OPTIONAL. 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 74 Optional. 75 If 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 62 80 =back 63 81
