Changeset 27614 for lang/perl

Show
Ignore:
Timestamp:
12/30/08 18:51:05 (5 years ago)
Author:
yusukebe
Message:

fixed bug

Location:
lang/perl/WWW-Yahoo-Lyrics-JP/trunk/lib/WWW/Yahoo/Lyrics
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/WWW-Yahoo-Lyrics-JP/trunk/lib/WWW/Yahoo/Lyrics/JP.pm

    r27583 r27614  
    3131    ); 
    3232    my $query      = _escape( $song->artist ) . "+" . _escape( $song->title ); 
    33     my $result_res = $self->ua->get( $self->end_point . $query ); 
    34     $result_res->content =~ m!<div id=\\"acx\\"><a href=\\"(.+?)\\">!; 
    35     return $song unless $1; 
    36     $1 =~ m!(\d+)/(Y\d{6})$!; 
    37     $song->aid($1); 
    38     $song->id($2); 
     33    my $url = $self->end_point . $query; 
     34    my $result_res = $self->ua->get( $url ); 
     35    return $song unless $result_res->is_success; 
     36    if($result_res->content =~ m!<div id=\\"acx\\"><a href=\\"(.+?)\\">!){ 
     37        $1 =~ m!(\d+)/(Y\d{6})$!; 
     38        $song->aid($1); 
     39        $song->id($2); 
     40    } 
    3941    return $song; 
    4042} 
  • lang/perl/WWW-Yahoo-Lyrics-JP/trunk/lib/WWW/Yahoo/Lyrics/JP/Song.pm

    r27583 r27614  
    1717    is  => 'rw', 
    1818    isa => 'Str', 
     19    deafult => '', 
    1920); 
    2021 
     
    2223    is  => 'rw', 
    2324    isa => 'Str', 
     25    deafult => '', 
    2426); 
    2527 
     
    2931sub swf_url { 
    3032    my $self = shift; 
    31     return unless $self->id && $self->aid; 
     33    return unless $self->id; 
    3234    return sprintf("http://music.yimg.jp/lyrics/lyrics.swf?id=%s&aid=%s", 
    3335                   $self->id, $self->aid); 
     
    3638sub embed_tag { 
    3739    my $self = shift; 
    38     return unless $self->id && $self->aid; 
     40    return unless $self->id; 
    3941    return sprintf(qq{<embed src="http://music.yimg.jp/lyrics/lyrics.swf?id=%s&aid=%s" autostart=0 allowScriptAccess="never"  width="500"  height="400" wmode="transparent"></embed>}, $self->id, $self->aid); 
    4042} 
     
    4244sub link { 
    4345    my $self = shift; 
    44     return unless $self->id && $self->aid; 
     46    return unless $self->id; 
    4547    return sprintf("http://music.yahoo.co.jp/shop/p/53/%s/%s", $self->aid, $self->id); 
    4648}