line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Riji::Model::Tag; |
2
|
1
|
|
|
1
|
|
8
|
use feature ':5.10'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
115
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use Encode; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
163
|
|
7
|
1
|
|
|
1
|
|
456
|
use MIME::Base32 1.301 (); |
|
1
|
|
|
|
|
1066
|
|
|
1
|
|
|
|
|
27
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use Mouse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has name => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => 'Str', |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has entries => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
isa => 'ArrayRef[Riji::Model::Entry]', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
default => sub { [] }, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has count => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
lazy => 1, |
27
|
|
|
|
|
|
|
default => sub { |
28
|
|
|
|
|
|
|
scalar @{ shift->entries }; |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has _encoded_name => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
default => sub { |
35
|
|
|
|
|
|
|
my $name = shift->name; |
36
|
|
|
|
|
|
|
return $name unless $name =~ /[^-_a-zA-Z0-9]/ms; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
'b32.'.MIME::Base32::encode_rfc3548(encode_utf8 $name); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has site_path => ( |
43
|
|
|
|
|
|
|
is => 'ro', |
44
|
|
|
|
|
|
|
default => sub { '/tag/' . shift->_encoded_name . '.html' }, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
1
|
|
445
|
no Mouse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub normalize_tag { |
50
|
0
|
|
|
0
|
0
|
|
my ($class, $tag) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if ($tag =~ s/^b32\.//) { |
53
|
0
|
|
|
|
|
|
return decode_utf8 MIME::Base32::decode_rfc3548($tag); |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
$tag; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |