line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#============================================================= -*-Perl-*- |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Template::Plugin::CGI |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# DESCRIPTION |
6
|
|
|
|
|
|
|
# Simple Template Toolkit plugin interfacing to the CGI.pm module. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# AUTHOR |
9
|
|
|
|
|
|
|
# Andy Wardley |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# COPYRIGHT |
12
|
|
|
|
|
|
|
# Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# This module is free software; you can redistribute it and/or |
15
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
#============================================================================ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Template::Plugin::CGI; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
22
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
23
|
1
|
|
|
1
|
|
3
|
use base 'Template::Plugin'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
353
|
|
24
|
1
|
|
|
1
|
|
5
|
use CGI; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = 2.70; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
2
|
|
|
2
|
1
|
2
|
my $class = shift; |
30
|
2
|
|
|
|
|
2
|
my $context = shift; |
31
|
2
|
|
|
|
|
11
|
CGI->new(@_); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# monkeypatch CGI::params() method to Do The Right Thing in TT land |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub CGI::params { |
37
|
3
|
|
|
3
|
0
|
22
|
my $self = shift; |
38
|
3
|
|
|
|
|
4
|
local $" = ', '; |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
66
|
|
|
50
|
return $self->{ _TT_PARAMS } ||= do { |
41
|
|
|
|
|
|
|
# must call Vars() in a list context to receive |
42
|
|
|
|
|
|
|
# plain list of key/vals rather than a tied hash |
43
|
1
|
|
|
|
|
4
|
my $params = { $self->Vars() }; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# convert any null separated values into lists |
46
|
|
|
|
|
|
|
@$params{ keys %$params } = map { |
47
|
1
|
100
|
|
|
|
91
|
/\0/ ? [ split /\0/ ] : $_ |
|
2
|
|
|
|
|
11
|
|
48
|
|
|
|
|
|
|
} values %$params; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
10
|
$params; |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |