line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Time::Duration; |
2
|
1
|
|
|
1
|
|
177678
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
71
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Template::Plugin; |
7
|
1
|
|
|
1
|
|
5
|
use base qw(Template::Plugin); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1101
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1736
|
use Time::Duration qw(); |
|
1
|
|
|
|
|
2692
|
|
|
1
|
|
|
|
|
373
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
1
|
203994
|
sub ago { shift; return Time::Duration::ago(@_) }; |
|
1
|
|
|
|
|
7
|
|
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
1
|
|
sub ago_exact { shift; return Time::Duration::ago_exact(@_) }; |
|
0
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
1
|
|
sub concise { shift; return Time::Duration::concise(@_) }; |
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
0
|
1
|
|
sub duration { shift; return Time::Duration::duration(@_); } |
|
0
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
1
|
|
sub duration_exact { shift; return Time::Duration::duration_exact(@_); } |
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
1
|
|
sub from_now { shift; return Time::Duration::from_now(@_) }; |
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
0
|
1
|
|
sub from_now_exact { shift; return Time::Duration::from_now_exact(@_) }; |
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
|
sub later { shift; return Time::Duration::later(@_) }; |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
1
|
|
sub later_exact { shift; return Time::Duration::later_exact(@_) }; |
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
1
|
|
sub earlier { shift; return Time::Duration::earlier(@_) }; |
|
0
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
|
sub earlier_exact { shift; return Time::Duration::earlier_exact(@_) }; |
|
0
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Template::Plugin::Time::Duration - Time::Duration functions for Template Toolkit |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
[% USE time_dir = Time.Duration %] |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This thing happened [% time_dir.ago(some_seconds) %]. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This plugin allows you to use functions from Time::Duration in your templates. |
48
|
|
|
|
|
|
|
It is very simple and hopefully requires little explanation. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 FUNCTIONS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 ago |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 ago_exact |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 concise |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 duration |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 duration_exact |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 from_now |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 from_now_exact |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 later |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 later_exact |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 earlier |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 earlier_exact |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SEE ALSO |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Cory G Watson, C<< >> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Copyright 2010 Cold Hard Code, LLC |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
87
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
88
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |