Show
Ignore:
Timestamp:
12/08/08 21:08:15 (4 years ago)
Author:
bayashi
Message:

fixed and fixed

Location:
lang/perl/WWW-Hatena-IconURL/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/WWW-Hatena-IconURL/trunk/Changes

    r21302 r26126  
    11Revision history for WWW-Hatena-IconURL 
    22 
     31.0.1  Mon DEC 08 20:55:55 2008 
     4       Initial release. 
     5        
    361.0.0  Mon Oct 14 14:14:14 2008 
    47       Initial release. 
  • lang/perl/WWW-Hatena-IconURL/trunk/META.yml

    r21302 r26126  
    11--- 
    22name: WWW-Hatena-IconURL 
    3 version: 1.0.0 
     3version: 1.0.1 
    44author: 
    55  - 'Dai Okabayashi <genkivogue@ybb.ne.jp>' 
     
    1515  WWW::Hatena::IconURL: 
    1616    file: lib/WWW/Hatena/IconURL.pm 
    17     version: 1.0.0 
     17    version: 1.0.1 
    1818generated_by: Module::Build version 0.3 
    1919meta-spec: 
  • lang/perl/WWW-Hatena-IconURL/trunk/lib/WWW/Hatena/IconURL.pm

    r21302 r26126  
    44use strict; 
    55 
    6 use version; our $VERSION = qv('1.0.0'); 
     6use version; our $VERSION = qv('1.0.1'); 
    77 
    88use URI; 
     
    1010sub new { 
    1111    my $class = shift; 
    12     my $id    = shift || return; 
     12    my $id    = shift; 
    1313    return '' unless $class->_check_id($id); 
    1414    return bless { 'id' => $id }, $class; 
     
    1616 
    1717sub id { 
    18     my $self = shift || return; 
     18    my $self = shift; 
    1919    return $self->{id}; 
    2020} 
    2121 
    2222sub icon { 
    23     my $self = shift || return; 
     23    my $self = shift; 
    2424    return URI->new( 
    2525        "http://www.hatena.ne.jp/users/".substr($self->{id}, 0, 2)."/$self->{id}/profile.gif" 
    26     ) if $self and $self->{id}; 
     26    ) if $self->{id}; 
    2727    return ''; 
    2828} 
    2929 
    3030sub icon_s { 
    31     my $self = shift || return; 
     31    my $self = shift; 
    3232    return URI->new( 
    3333        "http://www.hatena.ne.jp/users/".substr($self->{id}, 0, 2)."/$self->{id}/profile_s.gif" 
    34     ) if $self and $self->{id}; 
     34    ) if $self->{id}; 
    3535    return ''; 
    3636} 
     
    3939    my $self = shift; 
    4040    my $id   = shift; 
    41     return 1 if $id =~ /^[a-zA-Z0-9\_\-]+[a-zA-Z0-9]$/ 
     41    return 1 if $id =~ /^[a-zA-Z0-9][a-zA-Z0-9\_\-]*[a-zA-Z0-9]$/; 
    4242} 
    4343 
  • lang/perl/WWW-Hatena-IconURL/trunk/t/01.basic.t

    r21302 r26126  
    1 use Test::More tests => 3; 
     1use strict; 
     2use warnings; 
     3 
     4use Test::More tests => 9; 
    25 
    36use WWW::Hatena::IconURL; 
    47 
    5 my $id2url = WWW::Hatena::IconURL->new("genkivogue"); # genkivogue is author's id ;-) 
     8 
     9my $no_id = WWW::Hatena::IconURL->new(''); 
     10is($no_id, '', "no id"); 
     11my $wrong_id = WWW::Hatena::IconURL->new('hoge_'); 
     12is($wrong_id, '', "wrong id"); 
     13my $id2url = WWW::Hatena::IconURL->new("genkivogue"); 
     14is(ref $id2url, 'WWW::Hatena::IconURL', "new"); 
    615 
    716 
    817is($id2url->id, 'genkivogue', "id"); 
     18is(WWW::Hatena::IconURL::id(), undef, "no id"); 
    919 
    1020 
    1121is($id2url->icon, 'http://www.hatena.ne.jp/users/ge/genkivogue/profile.gif', "icon"); 
     22is(WWW::Hatena::IconURL::icon(), '', "no icon"); 
    1223 
    1324 
    1425is($id2url->icon_s, 'http://www.hatena.ne.jp/users/ge/genkivogue/profile_s.gif', "icon_s"); 
     26is(WWW::Hatena::IconURL::icon_s(), '', "no icon_s"); 
    1527 
    16