From f1b126ae0a301c7164a1cbc401d79a0e49a5c215 Mon Sep 17 00:00:00 2001 From: mitty Date: Sat, 18 Dec 2010 15:00:37 +0000 Subject: [PATCH] * dump_timeline.pl now parses 4 parameters {{{ usage: dump_timeline.pl [user_timeline(default)|retweeted_by_me| [screen_name [number_of_pages|all [dump] ] ] ] }}} * supported method => user_timeline, retweeted_by_me, mentions * default method is user_timeline git-svn-id: https://lab.mitty.jp/svn/lab/trunk@97 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- Dev/twitter/dump_timeline.pl | 45 +++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/Dev/twitter/dump_timeline.pl b/Dev/twitter/dump_timeline.pl index 36fd046..246a1d4 100755 --- a/Dev/twitter/dump_timeline.pl +++ b/Dev/twitter/dump_timeline.pl @@ -15,15 +15,25 @@ use YAML::Tiny; use Data::Dumper; use Encode; -if (@ARGV < 1) { - die "usage: $0 screen_name [number_of_pages|all [dump]]\n"; +if ($ARGV[0] && ($ARGV[0] eq '--help' || $ARGV[0] eq '-h') ) { + die <user_timeline( - { - screen_name => $screen_name, - page => $page, - } - ); + + my $param = ($screen_name) + ? { page => $page, screen_name => $screen_name, } + : { page => $page, } + ; + + my $res; + if ($method eq 'user_timeline') { + $res = $bot->user_timeline($param); + } + elsif ($method eq 'retweeted_by_me') { + $res = $bot->retweeted_by_me($param); + } + elsif ($method eq 'mentions') { + $res = $bot->mentions($param); + } + else { + die "$0: unknown method => $method\n"; + } if ($dump) { foreach my $line (split /\n/, Dumper $res) { -- 1.7.9.5