Changeset fe75883 in lab.git for Dev/twitter


Ignore:
Timestamp:
Dec 19, 2010 12:11:03 AM (14 years ago)
Author:
mitty <mitty@…>
Branches:
master, trunk
Children:
294a3aa
Parents:
f1b126a
Message:
  • pack usage message to $help = sub {...}
  • remove needless '\n' and "done\n"

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@98 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/twitter/dump_timeline.pl

    rf1b126a rfe75883  
    1616use Encode; 
    1717 
    18 if ($ARGV[0] && ($ARGV[0] eq '--help' || $ARGV[0] eq '-h') ) { 
     18my $help = sub { 
    1919    die <<EOM; 
    2020usage: $0 
     
    2727    ] 
    2828EOM 
     29}; 
     30if ($ARGV[0] && ($ARGV[0] eq '--help' || $ARGV[0] eq '-h') ) { 
     31    &{$help}; 
    2932} 
     33 
    3034my $method = $ARGV[0] || 'user_timeline'; 
    3135my $screen_name = $ARGV[1] || ''; 
     
    3842my $conf = loadconf("$Bin/config.yml"); 
    3943if (! defined $conf) { 
    40     die "$0: cannot parse config file.\n"; 
     44    die "$0: cannot parse config file."; 
    4145} 
    4246 
    4347my $bot = login($conf); 
    4448if (! $bot->authorized) { 
    45     die "$0: this client is not yet authorized.\n"; 
     49    die "$0: this client is not yet authorized."; 
    4650} 
    4751 
     
    6872        } 
    6973        else { 
    70             die "$0: unknown method => $method\n"; 
     74            warn "$0: unknown method '$method'"; 
     75            &{$help}; 
    7176        } 
    7277         
     
    9398    evalrescue($@); 
    9499} 
    95 print "done\n"; 
    96100 
    97101 
     
    106110     
    107111    if ($!) { 
    108         warn "$0: '$file' $!\n"; 
     112        warn "$0: '$file' $!"; 
    109113    } 
    110114     
Note: See TracChangeset for help on using the changeset viewer.