Changeset 108 in lab


Ignore:
Timestamp:
Jan 12, 2011 8:08:41 PM (13 years ago)
Author:
mitty
Message:
  • "-d" option to print all data except 'undef'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Dev/twitter/show_status.pl

    r62 r108  
    1515my $bot = Net::Twitter::Lite->new; 
    1616 
     17my $dump; 
     18if (defined $ARGV[0] and $ARGV[0] eq "-d") { 
     19    $dump = shift @ARGV; 
     20} 
     21 
    1722eval { 
    1823    foreach my $id (@ARGV) { 
     24        $id =~ /\/?(\d+)$/; 
     25        $id = $1; 
    1926        my $res = $bot->show_status($id); 
    2027        foreach my $line (split /\n/, Dumper $res) { 
    2128            if ($line =~ /undef/) { next; } 
    22             unless ($line =~ / => {/ 
    23                 ||  $line =~ / = / 
    24                 ||  $line =~ /status/ 
    25                 ||  $line =~ /'text'/ 
    26                 ||  $line =~ /created/ 
    27                 ||  $line =~ /'id'/ 
    28                 ||  $line =~ /name/ 
    29                 ||  $line =~ / },/ 
    30                 ||  $line =~ / };/ 
    31             ) { next; } 
     29            if (! $dump) { 
     30                unless ($line =~ / => {/ 
     31                    ||  $line =~ / = / 
     32                    ||  $line =~ /status/ 
     33                    ||  $line =~ /'text'/ 
     34                    ||  $line =~ /created/ 
     35                    ||  $line =~ /'id'/ 
     36                    ||  $line =~ /name/ 
     37                    ||  $line =~ / },/ 
     38                    ||  $line =~ / };/ 
     39                ) { next; } 
     40            } 
    3241            print $line, "\n"; 
    3342        } 
     
    3746    evalrescue($@); 
    3847} 
    39 print "truncated output done\n"; 
    4048 
    4149 
Note: See TracChangeset for help on using the changeset viewer.