Changeset 293

Show
Ignore:
Timestamp:
10/01/06 22:54:39 (2 years ago)
Author:
miya
Message:

r133@kenny: miya | 2006-10-01 20:18:32 +0900
modify Entry.pm

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plagger/trunk/lib/Plagger/Entry.pm

    r291 r293  
    33 
    44use base qw( Plagger::Thing ); 
    5 __PACKAGE__->mk_accessors(qw( title author tags link feed_link id summary body rate icon meta source )); 
     5__PACKAGE__->mk_accessors(qw( title author tags link feed_link summary body rate icon meta source )); 
    66__PACKAGE__->mk_date_accessors(qw( date )); 
    77 
     
    1919        meta    => {}, 
    2020        enclosures => [], 
    21         events     => [], 
    2221    }, $class; 
    2322} 
     
    4948} 
    5049 
     50sub id { 
     51    my $self = shift; 
     52    $self->{id} = shift if @_; 
     53    $self->{id} || $self->permalink || do { 
     54        my $id = $self->feed_link; 
     55        $id .= $self->date ? $self->date->epoch : $self->title; 
     56        $id; 
     57    }; 
     58} 
     59 
    5160sub id_safe { 
    5261    my $self = shift; 
    53     my $id   = $self->id || $self->permalink; 
    54  
    55     # entry without id or permalink. Try entry's date or title 
    56     unless ($id) { 
    57         $id  = $self->feed_link; 
    58         $id .= $self->date ? $self->date->epoch : $self->title; 
    59     } 
    60  
    61     $id =~ m!^https?://! ? Digest::MD5::md5_hex($id) : $id; 
     62    Plagger::Util::safe_id($self->id); 
    6263} 
    6364 
     
    124125 
    1251261; 
     127