Changeset 12870

Show
Ignore:
Timestamp:
05/31/08 02:22:46 (6 months ago)
Author:
yusukebe
Message:

if ... elsif ... やめて ハッシュテーブル使った thanks:otsune

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/WWW-CDTV/trunk/lib/WWW/CDTV.pm

    r12869 r12870  
    4444EOF 
    4545    my @tracks; 
     46    my %move_table = ( '新' => 'new', '↑' => 'up', '↓' => 'down', ); 
    4647    foreach my $entry_html (@match) { 
    4748        $entry_html =~ m/$entry_regex/gs; 
     
    5152            artist => decode_entities($4), 
    5253        }; 
    53         if ( $2 =~ /新/ ) { 
    54             $entry->{move} = "new"; 
    55         } 
    56         elsif ( $2 =~ /↑/ ) { 
    57             $entry->{move} = "up"; 
    58         } 
    59         elsif ( $2 =~ /↓/ ) { 
    60             $entry->{move} = "down"; 
    61         } 
     54        $entry->{move} = $move_table{$2}; 
    6255        $tracks[ $entry->{no} ] = WWW::CDTV::Track->new($entry); 
    6356    }