line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bootylicious::Article; |
2
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
3179
|
use strict; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
310
|
|
4
|
13
|
|
|
13
|
|
55
|
use warnings; |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
280
|
|
5
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
56
|
use base 'Bootylicious::Document'; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
3816
|
|
7
|
|
|
|
|
|
|
|
8
|
13
|
|
|
13
|
|
72
|
use Bootylicious::Timestamp; |
|
13
|
|
|
|
|
27
|
|
|
13
|
|
|
|
|
69
|
|
9
|
13
|
|
|
13
|
|
4210
|
use Bootylicious::Pingback; |
|
13
|
|
|
|
|
35
|
|
|
13
|
|
|
|
|
73
|
|
10
|
13
|
|
|
13
|
|
4029
|
use Bootylicious::PingbackIterator; |
|
13
|
|
|
|
|
33
|
|
|
13
|
|
|
|
|
84
|
|
11
|
13
|
|
|
13
|
|
4129
|
use Bootylicious::PingbackIteratorFinder; |
|
13
|
|
|
|
|
35
|
|
|
13
|
|
|
|
|
59
|
|
12
|
13
|
|
|
13
|
|
3937
|
use Bootylicious::Comment; |
|
13
|
|
|
|
|
32
|
|
|
13
|
|
|
|
|
81
|
|
13
|
13
|
|
|
13
|
|
4118
|
use Bootylicious::CommentIteratorLoader; |
|
13
|
|
|
|
|
37
|
|
|
13
|
|
|
|
|
71
|
|
14
|
|
|
|
|
|
|
|
15
|
18
|
50
|
|
18
|
0
|
48
|
sub title { my $self = shift; $self->metadata(title => @_) || $self->name } |
|
18
|
|
|
|
|
58
|
|
16
|
1
|
|
|
1
|
0
|
8
|
sub description { shift->metadata(description => @_) } |
17
|
8
|
|
|
8
|
0
|
646
|
sub link { shift->metadata(link => @_) } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub tags { |
20
|
20
|
|
|
20
|
0
|
44
|
my $self = shift; |
21
|
20
|
|
|
|
|
32
|
my $value = shift; |
22
|
|
|
|
|
|
|
|
23
|
20
|
50
|
|
|
|
47
|
if (defined $value) { |
24
|
|
|
|
|
|
|
$value = join ', ' => sort keys %{ |
25
|
0
|
0
|
|
|
|
0
|
{ map { $_ => 1 } |
|
0
|
|
|
|
|
0
|
|
26
|
0
|
|
|
|
|
0
|
map { s/^\s+//; s/\s+$//; $_ } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
27
|
0
|
|
|
|
|
0
|
grep { $_ ne '' } split ',' => $value |
|
0
|
|
|
|
|
0
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} if $value ne ''; |
30
|
0
|
|
|
|
|
0
|
return $self->metadata(tags => $value); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
20
|
|
|
|
|
61
|
my $tags = $self->metadata('tags'); |
34
|
20
|
50
|
|
|
|
60
|
return [] unless $tags; |
35
|
|
|
|
|
|
|
|
36
|
20
|
|
|
|
|
87
|
return [map { s/^\s+//; s/\s+$//; $_ } split ',' => $tags]; |
|
50
|
|
|
|
|
150
|
|
|
50
|
|
|
|
|
112
|
|
|
50
|
|
|
|
|
162
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
0
|
0
|
0
|
sub has_tags { shift->tags ? 1 : 0 } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub comments_enabled { |
42
|
3
|
|
|
3
|
0
|
35
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
25
|
my $comments = $self->metadata('comments'); |
45
|
|
|
|
|
|
|
|
46
|
3
|
100
|
66
|
|
|
29
|
return defined $comments && $comments =~ /^(no|false|disable)$/i ? 0 : 1; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub pingbacks { |
50
|
8
|
|
|
8
|
0
|
1385
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
8
|
|
|
|
|
29
|
return Bootylicious::PingbackIterator->new( |
53
|
|
|
|
|
|
|
path => $self->path . '.pingbacks'); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub has_pingback { |
57
|
5
|
|
|
5
|
0
|
25
|
my $self = shift; |
58
|
5
|
|
|
|
|
8
|
my $source_uri = shift; |
59
|
|
|
|
|
|
|
|
60
|
5
|
|
|
|
|
18
|
my $finder = |
61
|
|
|
|
|
|
|
Bootylicious::PingbackIteratorFinder->new(iterator => $self->pingbacks); |
62
|
|
|
|
|
|
|
|
63
|
5
|
100
|
|
|
|
18
|
return $finder->find($source_uri) ? 1 : 0; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub pingback { |
67
|
2
|
|
|
2
|
0
|
11
|
my $self = shift; |
68
|
2
|
|
|
|
|
5
|
my $source_uri = shift; |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
17
|
my $pingback = Bootylicious::Pingback->new( |
71
|
|
|
|
|
|
|
created => Bootylicious::Timestamp->new(epoch => time), |
72
|
|
|
|
|
|
|
source_uri => $source_uri |
73
|
|
|
|
|
|
|
); |
74
|
2
|
|
|
|
|
19
|
return $pingback->create($self->path . '.pingbacks'); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub comments { |
78
|
15
|
|
|
15
|
0
|
38
|
my $self = shift; |
79
|
|
|
|
|
|
|
|
80
|
15
|
|
|
|
|
58
|
return Bootylicious::CommentIteratorLoader->new(path => $self->path) |
81
|
|
|
|
|
|
|
->load(Bootylicious::Iterator->new); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub comment { |
85
|
4
|
|
|
4
|
0
|
12
|
my $self = shift; |
86
|
4
|
|
|
|
|
26
|
my %params = @_; |
87
|
|
|
|
|
|
|
|
88
|
4
|
|
|
|
|
9
|
my $number = 1; |
89
|
|
|
|
|
|
|
|
90
|
4
|
100
|
|
|
|
24
|
if (my $last = $self->comments->last) { |
91
|
3
|
|
|
|
|
9
|
($number) = ($last->path =~ m/\.comment-(\d+)/); |
92
|
3
|
|
|
|
|
30
|
$number++; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
4
|
|
|
|
|
19
|
my $path = $self->path . '.comment-' . $number; |
96
|
|
|
|
|
|
|
|
97
|
4
|
|
|
|
|
33
|
my $comment = Bootylicious::Comment->new(@_); |
98
|
|
|
|
|
|
|
|
99
|
4
|
|
|
|
|
15
|
return $comment->create($path); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |