line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenPlugin::Cookie::CGI; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: CGI.pm,v 1.21 2003/04/03 01:51:24 andreychek Exp $ |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
2409
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
6
|
1
|
|
|
1
|
|
751
|
use OpenPlugin::Cookie(); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
5
|
use base qw( OpenPlugin::Cookie ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
446
|
|
8
|
1
|
|
|
1
|
|
14
|
use CGI qw( -no_debug ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
9
|
1
|
|
|
1
|
|
1897
|
use CGI::Cookie qw(); |
|
1
|
|
|
|
|
2874
|
|
|
1
|
|
|
|
|
237
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$OpenPlugin::Cookie::CGI::VERSION = sprintf("%d.%02d", q$Revision: 1.21 $ =~ /(\d+)\.(\d+)/); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
1
|
|
|
1
|
0
|
2
|
my ( $self, $args ) = @_; |
16
|
|
|
|
|
|
|
|
17
|
1
|
50
|
|
|
|
5
|
return $self unless $self->OP->request->object; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
5
|
my $cookies = CGI::Cookie->fetch; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Tell OpenPlugin about each cookie we were sent |
22
|
1
|
|
|
|
|
10
|
foreach my $cookie ( keys %{ $cookies } ) { |
|
1
|
|
|
|
|
6
|
|
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
0
|
$self->set_incoming({ name => $cookies->{$cookie}->name, |
25
|
|
|
|
|
|
|
value => $cookies->{$cookie}->value, |
26
|
|
|
|
|
|
|
domain => $cookies->{$cookie}->domain, |
27
|
|
|
|
|
|
|
path => $cookies->{$cookie}->path, |
28
|
|
|
|
|
|
|
expires => $cookies->{$cookie}->expires, |
29
|
|
|
|
|
|
|
secure => $cookies->{$cookie}->secure, |
30
|
|
|
|
|
|
|
}) |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
6
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Cycle through the CGI::Cookie objects and |
37
|
|
|
|
|
|
|
# call the bake method, which puts the appropriate header |
38
|
|
|
|
|
|
|
# into the outgoing headers table. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub bake { |
41
|
0
|
|
|
0
|
0
|
|
my ( $self ) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
foreach my $name ( $self->get_outgoing ) { |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $args = $self->get_outgoing( $name ); |
46
|
0
|
|
|
|
|
|
$args->{name} = $name; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $cookie = CGI::Cookie->new( -name => $args->{name}, |
49
|
|
|
|
|
|
|
-value => $args->{value}, |
50
|
|
|
|
|
|
|
-path => $args->{path}, |
51
|
|
|
|
|
|
|
-expires => $args->{expires}, |
52
|
|
|
|
|
|
|
-secure => $args->{secure}, |
53
|
|
|
|
|
|
|
); |
54
|
0
|
|
|
|
|
|
print "Set-Cookie: $cookie\n"; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
return 1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |