line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Forge::CGI; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# use strict; |
4
|
|
|
|
|
|
|
# use vars qw( @ISA ); |
5
|
1
|
|
|
1
|
|
411
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
65
|
|
6
|
1
|
|
|
1
|
|
323
|
use Text::Forge; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
188
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
@ISA = qw( Text::Forge ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
2
|
|
|
2
|
0
|
70
|
my $class = shift; |
12
|
2
|
|
|
|
|
3
|
local($_); |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
66
|
|
|
8
|
$class = ref($class) || $class; |
15
|
2
|
|
|
|
|
13
|
my $self = $class->SUPER::new( @_ ); |
16
|
2
|
|
|
|
|
7
|
$self->{'header'}->content_type('text/html'); |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
18
|
$self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _post_template { |
22
|
1
|
|
|
1
|
|
18
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
6
|
$self->SUPER::_post_template; |
25
|
1
|
|
|
|
|
5
|
$self->{'header'}->content_length( length $self->{content} ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub redirect { |
29
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my $url = shift; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# XXX Is this portable? |
33
|
0
|
|
0
|
|
|
|
$url ||= "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}$ENV{REQUEST_URI}"; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if ($self->{_in_template}) { |
36
|
0
|
|
|
|
|
|
$self->{'header'}->header( Status => '302 Moved', |
37
|
|
|
|
|
|
|
Location => $url ); |
38
|
|
|
|
|
|
|
} else { |
39
|
0
|
|
|
|
|
|
print "Location: $url\nStatus: 302 Moved\n\n"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |