line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Filter::String::Truncate; |
2
|
|
|
|
|
|
|
$Template::Plugin::Filter::String::Truncate::VERSION = '0.03'; |
3
|
|
|
|
|
|
|
# ABSTRACT: String::Truncate filter for Template::Toolkit |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
73467
|
use 5.006; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
81
|
|
6
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
73
|
|
7
|
2
|
|
|
2
|
|
20
|
use base 'Template::Plugin::Filter'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1797
|
|
8
|
2
|
|
|
2
|
|
11074
|
use String::Truncate; |
|
2
|
|
|
|
|
64740
|
|
|
2
|
|
|
|
|
17
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $DYNAMIC = 1; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
3
|
|
|
3
|
0
|
5930
|
my $self = shift; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
15
|
$self->install_filter('elide'); |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
132
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub filter { |
21
|
3
|
|
|
3
|
0
|
262
|
my ($self, $text, $args, $conf) = @_; |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
|
|
5
|
my ($len) = @$args; |
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
13
|
$text = String::Truncate::elide($text, $len, $conf); |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
130
|
return $text; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |