| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Template::Provider::ArchiveTar; |
|
2
|
2
|
|
|
2
|
|
35773
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
63
|
|
|
3
|
2
|
|
|
2
|
|
9
|
use Carp qw(croak); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
131
|
|
|
4
|
2
|
|
|
2
|
|
1035
|
use parent 'Template::Provider'; |
|
|
2
|
|
|
|
|
564
|
|
|
|
2
|
|
|
|
|
11
|
|
|
5
|
2
|
|
|
2
|
|
29409
|
use vars '$VERSION'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
418
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Template::Provider::ArchiveTar - fetch templates from an archive |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $t = $info->{template} || Template->new({ |
|
15
|
|
|
|
|
|
|
POST_CHOMP => 1, |
|
16
|
|
|
|
|
|
|
DEBUG => 1, |
|
17
|
|
|
|
|
|
|
LOAD_TEMPLATES => [ |
|
18
|
|
|
|
|
|
|
Template::Provider::ArchiveTar->new({ |
|
19
|
|
|
|
|
|
|
archive => Archive::Tar->new('theme.tar'), |
|
20
|
|
|
|
|
|
|
}), |
|
21
|
|
|
|
|
|
|
], |
|
22
|
|
|
|
|
|
|
}); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _init { |
|
27
|
0
|
|
|
0
|
|
|
my( $class, $options ) = @_; |
|
28
|
|
|
|
|
|
|
my $archive = delete $options->{archive} |
|
29
|
0
|
0
|
|
|
|
|
or croak "Need a valid archive object for the template files"; |
|
30
|
0
|
|
|
|
|
|
my $self = $class->SUPER::_init( $options ); |
|
31
|
0
|
|
|
|
|
|
$self->{archive} = $archive; |
|
32
|
|
|
|
|
|
|
}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _template_modified { |
|
35
|
0
|
|
|
0
|
|
|
my ($self,$path) = @_; |
|
36
|
|
|
|
|
|
|
# we fake this by always returning a fresh timestamp so no caching here |
|
37
|
|
|
|
|
|
|
return time |
|
38
|
0
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _template_content { |
|
41
|
0
|
|
|
0
|
|
|
my ($self,$path) = @_; |
|
42
|
0
|
|
|
|
|
|
my $content = $self->{archive}->get_content($path); |
|
43
|
0
|
0
|
|
|
|
|
if( wantarray ) { |
|
44
|
0
|
|
|
|
|
|
return ($content,'',time); |
|
45
|
|
|
|
|
|
|
} else { |
|
46
|
0
|
|
|
|
|
|
return $content |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
}; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Using this module you can provide templates through a Tar archive or any |
|
55
|
|
|
|
|
|
|
object compatible with the API of L. Interesting examples |
|
56
|
|
|
|
|
|
|
are L, L and L. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 REPOSITORY |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
The public repository of this module is |
|
67
|
|
|
|
|
|
|
L. |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SUPPORT |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
The public support forum of this module is |
|
72
|
|
|
|
|
|
|
L. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 BUG TRACKER |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Please report bugs in this module via the RT CPAN bug queue at |
|
77
|
|
|
|
|
|
|
L |
|
78
|
|
|
|
|
|
|
or via mail to L. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Max Maischein C |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT (c) |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Copyright 2014-2016 by Max Maischein C. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 LICENSE |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This module is released under the same terms as Perl itself. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |