| 1 | package OpenInteract2::Cookie; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | # $Id: Cookie.pm,v 1.12 2005/03/17 14:57:58 sjn Exp $ | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 87 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 87 | ▶ | use CGI::Cookie; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 87 | ▶ | use OpenInteract2::Context qw( CTX DEPLOY_URL ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 87 | $OpenInteract2::Cookie::VERSION = sprintf("%d.%02d", q$Revision: 1.12 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | # keys names, values CGI::Cookie objects | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 0 | ▶ | sub parse { | ||||||||||||||||||
|
Subroutine
parse: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 14 | 0 | my ( $class, $cookie_header ) = @_; | |||||||||||||||||||
| 15 | 0 | return { CGI::Cookie->parse( $cookie_header ) }; | |||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 0 | ▶ | sub create { | ||||||||||||||||||
|
Subroutine
create: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||
| 19 | 0 | my ( $class, $params ) = @_; | |||||||||||||||||||
| 20 | 0 | my %cgi_params = (); | |||||||||||||||||||
| 21 | 0 | my @cgi_keys = qw( name value expires domain path ); | |||||||||||||||||||
| 22 | 0 | foreach my $key ( @cgi_keys ) { | |||||||||||||||||||
| 23 | 0 | ▶ | next unless ( $params->{ $key } ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 24 | 0 | $cgi_params{ "-$key" } = $params->{ $key }; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | 0 | ▶ | $cgi_params{ "-path" } ||= DEPLOY_URL; | ||||||||||||||||||
|
Condition0%0/3
$cgi_params{"-path"} ||= DEPLOY_URL()
MC/DC0%0/2
$cgi_params{"-path"} ||= DEPLOY_URL()
$cgi_params{"-path"}
DEPLOY_URL()
Truth table0%0/3
A ||= B
A= $cgi_params{"-path"}B= DEPLOY_URL()
| |||||||||||||||||||||
| 27 | 0 | my $cookie = CGI::Cookie->new( %cgi_params ); | |||||||||||||||||||
| 28 | 0 | ▶ | if ( $params->{HEADER} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 29 | 0 | CTX->response->cookie( $cookie ); | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | 0 | return $cookie; | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 0 | ▶ | sub expire { | ||||||||||||||||||
|
Subroutine
expire: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 35 | 0 | my ( $class, $cookie_name ) = @_; | |||||||||||||||||||
| 36 | 0 | $class->create({ name => $cookie_name, | |||||||||||||||||||
| 37 | path => DEPLOY_URL, | ||||||||||||||||||||
| 38 | value => undef, | ||||||||||||||||||||
| 39 | expires => '-3M', | ||||||||||||||||||||
| 40 | HEADER => 'yes' }); | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 87 | 1; | |||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||