line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::Feed::Deduper; |
2
|
4
|
|
|
4
|
|
115651
|
use strict; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
172
|
|
3
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
120
|
|
4
|
4
|
|
|
4
|
|
108
|
use 5.008008; |
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
307
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
5758
|
use XML::Feed; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Mouse; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
no Mouse; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub BUILD { |
15
|
|
|
|
|
|
|
my ($self, $args) = @_; |
16
|
|
|
|
|
|
|
my $engine = delete $args->{engine} || 'DB_File'; |
17
|
|
|
|
|
|
|
$engine = $engine =~ s/^\+// ? $engine : "@{[ __PACKAGE__ ]}::${engine}"; |
18
|
|
|
|
|
|
|
Mouse::Util::load_class($engine); |
19
|
|
|
|
|
|
|
my $instance = $engine->new($args) or die 'wtf?'; |
20
|
|
|
|
|
|
|
$self->{engine} = $instance; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub dedup { |
24
|
|
|
|
|
|
|
my ($self, @entries) = @_; |
25
|
|
|
|
|
|
|
my $engine = $self->{engine} or die 'wtf?'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my @res; |
28
|
|
|
|
|
|
|
for my $entry (@entries) { |
29
|
|
|
|
|
|
|
next unless $engine->is_new($entry); |
30
|
|
|
|
|
|
|
push @res, $entry; |
31
|
|
|
|
|
|
|
$engine->add($entry); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
return @res; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |