Index: twitter/twitterbot.pl
===================================================================
--- twitter/twitterbot.pl	(revision 35889d4eb83a3569fbcc4c7b4792656f000d1ac8)
+++ twitter/twitterbot.pl	(revision f72bb76606e0285df3df349a477cb6c0de479972)
@@ -14,4 +14,10 @@
 use YAML::Tiny;
 
+sub VERBOSE () { $ARGV[0] eq 'verbose' };
+sub DEBUG   () { VERBOSE or $ARGV[0] eq 'debug' };
+use Data::Dumper;
+
+DEBUG and warn "$0: debug mode";
+
 my $conf = loadconf("$Bin/config.yml");
 if (! defined $conf) {
@@ -45,5 +51,5 @@
         next;
     }
-    sleep($conf->{sleep});
+    DEBUG or sleep($conf->{sleep});
     # retweet found tweet
     #   $tweets->{$id} eq 'search'  => found by search API
@@ -51,5 +57,6 @@
     my $res;
     eval {
-        $res = $bot->retweet($id);
+        DEBUG  or $res = $bot->retweet($id);
+        DEBUG and warn "retweet($id) => ", Dumper($tweets{$id});
     };
     if ($@) {
@@ -64,5 +71,6 @@
 if (%tweets) {
     # save last status to yaml file
-    YAML::Tiny::DumpFile("$Bin/status.yml", $stat);
+    DEBUG  or YAML::Tiny::DumpFile("$Bin/status.yml", $stat);
+    DEBUG and warn "status.yml => ", Dumper($stat);
 }
 
@@ -121,4 +129,5 @@
         }
     }
+    DEBUG and warn "searching '$key'";
     
     my $res;
@@ -134,4 +143,5 @@
         }
         if ($res->{results}) {
+            VERBOSE and warn Dumper($res->{results});
             foreach my $tweet (@{$res->{results}}) {
                 my $res = $bot->show_status($tweet->{id});
@@ -142,4 +152,5 @@
                     $ids->{$tweet->{id}} = 'search';
                 }
+                VERBOSE and warn Dumper($res);
             }
         }
@@ -149,4 +160,5 @@
     }
     
+    DEBUG and warn "search result => ", Dumper($ids);
     return $ids;
 }
@@ -168,4 +180,5 @@
             }
         );
+        VERBOSE and warn Dumper($res);
     };
     if ($@) {
@@ -173,5 +186,5 @@
     }
     
-    my $ids;
+    my $ids = {};
     if ($res && @{$res}) {
         $ids = {
@@ -180,4 +193,5 @@
     }
     
+    DEBUG and warn "mentions result => ", Dumper($ids);
     return $ids;
 }
