Created
September 10, 2009 09:37
-
-
Save poppen/184440 to your computer and use it in GitHub Desktop.
Sending Private Timeline on Wassr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use utf8; | |
| use Encode; | |
| use Getopt::Long; | |
| use Config::Pit; | |
| use WWW::Wassr; | |
| sub usage { | |
| my $usage = <<"END_USAGE"; | |
| Usage: $0 [-i file] user_id user_id ... | |
| Options: | |
| -i/-infile : message | |
| END_USAGE | |
| return $usage; | |
| } | |
| # ログイン情報 | |
| my $config = pit_get("wassr.jp", require => { | |
| "username" => "your username on wassr", | |
| "password" => "your password on wassr", | |
| }); | |
| my $infile = '-'; | |
| my $options = GetOptions( | |
| 'in=s' => \$infile, | |
| ); | |
| die usage() if (scalar @ARGV == 0); | |
| my $message; | |
| if ($infile eq '-') { | |
| $message = do { local $/; <STDIN> }; | |
| } | |
| else { | |
| open( my $fh, "<:utf8", $infile ) or die "$!"; | |
| $message = do { local $/; <$fh> }; | |
| } | |
| die "message must be less than 255." if length($message) > 255; | |
| my $wassr = WWW::Wassr->new( | |
| user => $config->{username}, | |
| passwd => $config->{password} | |
| ); | |
| $wassr->login(); | |
| for my $user_id (@ARGV) { | |
| $wassr->private_update( | |
| ( | |
| user_id => $user_id, | |
| message => $message, | |
| ) | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment