line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#$Id: CVcgi.pm 104 2007-06-25 05:57:38Z zag $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package HTML::WebDAO::CVcgi; |
4
|
5
|
|
|
5
|
|
30
|
use HTML::WebDAO::Base; |
|
5
|
|
|
|
|
24
|
|
|
5
|
|
|
|
|
274
|
|
5
|
5
|
|
|
5
|
|
9931
|
use CGI; |
|
5
|
|
|
|
|
93254
|
|
|
5
|
|
|
|
|
65
|
|
6
|
5
|
|
|
5
|
|
319
|
use Data::Dumper; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
330
|
|
7
|
5
|
|
|
5
|
|
30
|
use base qw( HTML::WebDAO::Base ); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
615
|
|
8
|
5
|
|
|
5
|
|
27
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2389
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->attributes qw (Cgi_obj); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _init { |
13
|
|
|
|
|
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
my $cgi_obj = shift; |
15
|
|
|
|
|
|
|
my $cgi = $cgi_obj || new CGI::; |
16
|
|
|
|
|
|
|
Cgi_obj $self $cgi; |
17
|
|
|
|
|
|
|
return 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
sub get_cookie { |
20
|
|
|
|
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
return $self->Cgi_obj->cookie(@_) |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
sub response { |
24
|
|
|
|
|
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
my $res = shift || return; |
26
|
|
|
|
|
|
|
# $self->_log1(Dumper(\$res)); |
27
|
|
|
|
|
|
|
# my $r = $self->_req; |
28
|
|
|
|
|
|
|
# my $headers_out = $r->headers_out; |
29
|
|
|
|
|
|
|
my $cgi = $self->Cgi_obj; |
30
|
|
|
|
|
|
|
print $cgi->header( map { $_ => $res->{headers}->{$_} } keys %{$res->{headers}} ); |
31
|
|
|
|
|
|
|
# $r->content_type($res->{type}); |
32
|
|
|
|
|
|
|
print $res->{data}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub print { |
36
|
|
|
|
|
|
|
my $self = shift; |
37
|
|
|
|
|
|
|
print @_; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
=head2 referer |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Get current referer |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub referer { |
46
|
|
|
|
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
my $cgi = $self->Cgi_obj; |
48
|
|
|
|
|
|
|
return $cgi->referer |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
#path_info param url header |
51
|
|
|
|
|
|
|
sub AUTOLOAD { |
52
|
|
|
|
|
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
return if $HTML::WebDAO::CVcgi::AUTOLOAD =~ /::DESTROY$/; |
54
|
|
|
|
|
|
|
( my $auto_sub ) = $HTML::WebDAO::CVcgi::AUTOLOAD =~ /.*::(.*)/; |
55
|
|
|
|
|
|
|
return $self->Cgi_obj->$auto_sub(@_) |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
1; |