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
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
22
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
23
|
1
|
|
|
1
|
|
4
|
use base 'Template::Plugin'; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
501
|
|
24
|
1
|
|
|
1
|
|
5
|
use CGI; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = 2.70; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
2
|
|
|
2
|
1
|
3
|
my $class = shift; |
30
|
2
|
|
|
|
|
3
|
my $context = shift; |
31
|
2
|
|
|
|
|
14
|
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
|
43
|
my $self = shift; |
38
|
3
|
|
|
|
|
8
|
local $" = ', '; |
39
|
|
|
|
|
|
|
|
40
|
3
|
|
66
|
|
|
44
|
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
|
|
|
|
|
13
|
my $params = { $self->Vars() }; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# convert any null separated values into lists |
46
|
2
|
100
|
|
|
|
18
|
@$params{ keys %$params } = map { |
47
|
1
|
|
|
|
|
911
|
/\0/ ? [ split /\0/ ] : $_ |
48
|
|
|
|
|
|
|
} values %$params; |
49
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
16
|
$params; |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |