Changeset 367

Show
Ignore:
Timestamp:
03/08/06 10:57:48
Author:
miyagawa
Message:

Move deduping method to Plagger::Feed

Files:

Legend:

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

    r355 r367  
    7676} 
    7777 
     78sub dedupe_entries { 
     79    my $self = shift; 
     80    my %seen; 
     81    my @entries; 
     82    for my $entry ($self->entires) { 
     83        push @entries, $entry if !$seen{$entry->id}++; 
     84    } 
     85    $self->{entries} = \@entries; 
     86} 
     87 
    78881; 
  • trunk/plagger/lib/Plagger/Plugin/SmartFeed/All.pm

    r309 r367  
    1818 
    1919    # because it's "All" you have to dedupe the entries 
    20     my(%seen, @delete); 
    21     for my $entry ($self->{feed}->entries) { 
    22         if ($seen{$entry->permalink}++) { 
    23             push @delete, $entry; 
    24         } 
    25     } 
    26     $self->{feed}->delete_entry($_) for @delete; 
     20    $self->{feed}->dedupe_entries; 
    2721    $self->{feed}->sort_entries; 
    2822