line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bootylicious::TagCloud; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
571
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
113
|
|
4
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
110
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
23
|
use base 'Mojo::Base'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
315
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
__PACKAGE__->attr('articles'); |
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
27
|
use Bootylicious::Iterator; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
34
|
|
11
|
5
|
|
|
5
|
|
1517
|
use Bootylicious::Tag; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
25
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
3
|
|
|
3
|
1
|
24
|
my $self = shift->SUPER::new(@_); |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
|
|
31
|
return $self->build; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
0
|
0
|
sub modified { shift->articles->modified } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub build { |
22
|
3
|
|
|
3
|
0
|
10
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
7
|
my $tags = {}; |
25
|
3
|
|
|
|
|
13
|
while (my $article = $self->articles->next) { |
26
|
3
|
|
|
|
|
5
|
foreach my $name (@{$article->tags}) { |
|
3
|
|
|
|
|
12
|
|
27
|
7
|
|
|
|
|
17
|
my $tag = $tags->{$name}; |
28
|
|
|
|
|
|
|
|
29
|
7
|
|
100
|
|
|
38
|
$tag->{count} ||= 0; |
30
|
7
|
|
|
|
|
12
|
$tag->{count}++; |
31
|
|
|
|
|
|
|
|
32
|
7
|
100
|
|
|
|
31
|
$tag->{created} = $article->created unless $tag->{created}; |
33
|
|
|
|
|
|
|
$tag->{created} = $article->created |
34
|
7
|
50
|
|
|
|
21
|
if $article->created < $tag->{created}; |
35
|
7
|
|
100
|
|
|
34
|
$tag->{modified} ||= 0; |
36
|
|
|
|
|
|
|
$tag->{modified} = $article->modified |
37
|
7
|
50
|
|
|
|
27
|
if $article->modified > $tag->{modified}; |
38
|
|
|
|
|
|
|
|
39
|
7
|
|
|
|
|
53
|
$tags->{$name} = $tag; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
3
|
|
|
|
|
8
|
my @tags; |
44
|
3
|
|
|
|
|
17
|
foreach my $name (sort keys %$tags) { |
45
|
6
|
|
|
|
|
38
|
my $tag = $tags->{$name}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
push @tags, |
48
|
|
|
|
|
|
|
Bootylicious::Tag->new( |
49
|
|
|
|
|
|
|
name => $name, |
50
|
|
|
|
|
|
|
count => $tag->{count}, |
51
|
|
|
|
|
|
|
created => $tag->{created}, |
52
|
|
|
|
|
|
|
modified => $tag->{modified} |
53
|
6
|
|
|
|
|
31
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
27
|
return Bootylicious::Iterator->new(elements => [@tags]); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |