line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::View::Excel::Template::Plus; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1403299
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
54
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
42
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
432
|
use MRO::Compat; |
|
2
|
|
|
|
|
2191
|
|
|
2
|
|
|
|
|
39
|
|
7
|
2
|
|
|
2
|
|
462
|
use Excel::Template::Plus; |
|
2
|
|
|
|
|
303782
|
|
|
2
|
|
|
|
|
82
|
|
8
|
2
|
|
|
2
|
|
11
|
use Scalar::Util 'blessed'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
130
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
855
|
use Catalyst::Exception; |
|
2
|
|
|
|
|
174713
|
|
|
2
|
|
|
|
|
90
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.02_2'; |
13
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
10
|
use base 'Catalyst::View'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
904
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw[ |
18
|
|
|
|
|
|
|
etp_engine |
19
|
|
|
|
|
|
|
etp_config |
20
|
|
|
|
|
|
|
etp_params |
21
|
|
|
|
|
|
|
]); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
1
|
|
|
1
|
1
|
227025
|
my($class, $c, $args) = @_; |
25
|
1
|
|
|
|
|
5
|
my $self = $class->next::method($c, $args); |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
2246
|
my $config = $c->config->{'View::Excel::Template::Plus'}; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
50
|
|
|
82
|
$args->{etp_engine} ||= $config->{etp_engine} || 'TT'; |
|
|
|
33
|
|
|
|
|
30
|
1
|
|
50
|
|
|
7
|
$args->{etp_config} ||= $config->{etp_config} || {}; |
|
|
|
33
|
|
|
|
|
31
|
1
|
|
50
|
|
|
8
|
$args->{etp_params} ||= $config->{etp_params} || {}; |
|
|
|
33
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
9
|
$self->etp_engine($args->{etp_engine}); |
34
|
1
|
|
|
|
|
276
|
$self->etp_config($args->{etp_config}); |
35
|
1
|
|
|
|
|
274
|
$self->etp_params($args->{etp_params}); |
36
|
|
|
|
|
|
|
|
37
|
1
|
50
|
33
|
|
|
229
|
if ( defined $self->config->{TEMPLATE_EXTENSION} && $self->config->{TEMPLATE_EXTENSION} !~ /\./ ){ |
38
|
0
|
|
|
|
|
0
|
$c->log->warn(qq/Missing . (dot) in TEMPLATE_EXTENSION ( $class ), the attitude has changed with version 0.02./); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
47
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub process { |
45
|
1
|
|
|
1
|
1
|
19743
|
my $self = shift; |
46
|
1
|
|
|
|
|
1
|
my $c = shift; |
47
|
1
|
|
|
|
|
2
|
my @args = @_; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
6
|
my $template = $self->get_template_filename($c); |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
|
|
49
|
(defined $template) |
52
|
|
|
|
|
|
|
|| die 'No template specified for rendering'; |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
33
|
|
|
3
|
my $etp_engine = $c->stash->{etp_engine} || $self->etp_engine; |
55
|
1
|
|
33
|
|
|
183
|
my $etp_config = $c->stash->{etp_config} || $self->etp_config; |
56
|
1
|
|
33
|
|
|
133
|
my $etp_params = $c->stash->{etp_params} || $self->etp_params; |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
127
|
my $excel = $self->create_template_object($c => ( |
59
|
|
|
|
|
|
|
engine => $etp_engine, |
60
|
|
|
|
|
|
|
template => $template, |
61
|
|
|
|
|
|
|
config => $etp_config, |
62
|
|
|
|
|
|
|
params => $etp_params, |
63
|
|
|
|
|
|
|
)); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
$excel->param( $self->get_template_params($c) ); |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
0
|
$c->response->content_type('application/x-msexcel'); |
68
|
0
|
|
|
|
|
0
|
$c->response->body($excel->output); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub create_template_object { |
72
|
1
|
|
|
1
|
1
|
5
|
my ($self, $c, %options) = @_; |
73
|
1
|
|
|
|
|
9
|
Excel::Template::Plus->new( %options ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub get_template_filename { |
77
|
1
|
|
|
1
|
1
|
2
|
my ($self, $c) = @_; |
78
|
|
|
|
|
|
|
$c->stash->{template} |
79
|
|
|
|
|
|
|
|| |
80
|
1
|
50
|
|
|
|
3
|
($c->action . '.xml' . $self->config->{TEMPLATE_EXTENSION}); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub get_template_params { |
84
|
0
|
|
|
0
|
1
|
|
my ($self, $c) = @_; |
85
|
0
|
|
0
|
|
|
|
my $cvar = $self->config->{CATALYST_VAR} || 'c'; |
86
|
0
|
|
|
|
|
|
return ( $cvar => $c, %{ $c->stash } ); |
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=pod |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 NAME |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Catalyst::View::Excel::Template::Plus - A Catalyst View for Excel::Template::Plus |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# use the helper to create your View |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
MyApp_create.pl view Excel Excel::Template::Plus |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 DESCRIPTION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is a Catalyst View subclass which can handle rendering excel content |
108
|
|
|
|
|
|
|
through Excel::Template::Plus. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 CONFIG OPTIONS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=over 4 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item I<etp_engine> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item I<etp_config> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item I<etp_params> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 METHODS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=over 4 |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item B<new> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This really just handles consuming the configuration parameters. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item B<process> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item B<get_template_filename> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item B<get_template_params> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item B<create_template_object> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=back |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 BUGS |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
All complex software has bugs lurking in it, and this module is no |
143
|
|
|
|
|
|
|
exception. If you find a bug please either email me, or add the bug |
144
|
|
|
|
|
|
|
to cpan-RT. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHOR |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Stevan Little E<lt>stevan.little@iinteractive.comE<gt> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Robert Bohne E<lt>rbo@cpan.orgE<gt> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Copyright 2007 by Infinity Interactive, Inc. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L<http://www.iinteractive.com> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
161
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |