Zobel

 view release on metacpan or  search on metacpan

lib/LiveGeez/Cgi.pm  view on Meta::CPAN

sub ParseCookie
{
my $self = shift;

	return 1 if ( $self->{cookieParsed} );


	my $v;
	if ( $self->{apache} ) {
		my %c = Apache::Cookie->parse;
		return 1 unless ( $c{prefs} );
		$v = $c{prefs}->value;
	}
	else {
		# cookies are seperated by a semicolon and a space
		return 1 unless ( $ENV{'HTTP_COOKIE'} =~ /prefs/ );
		my ( @rawCookies ) = split ( /; /, $ENV{'HTTP_COOKIE'} );
		foreach ( @rawCookies ) {
	    		if ( /prefs/ ) {
				s/prefs\s+//;
				$v = $_;
				# print STDERR "Cookie: $v\n";
			}
		}
	}

	$v =~ s/=/,/g;
	$v =~ s/,/","/g;
	$v =~ s/^/"/g;
	$v =~ s/$/"/g;

lib/LiveGeez/Cgi.pm  view on Meta::CPAN

	#
	# return if nothing has changed
	#
 	return	if ( exists ( $self->{'cookie-geezsys'} )
		&& ( $self->{'cookie-geezsys'} eq $sysPragmaOut )             
		&& ( $self->{'cookie-7-bit'}   eq $bit7         )
		&& ( $self->{'cookie-lang'}    eq $lang         )
		&& ( $self->{'cookie-frames'}  eq $frames       )
		);

	$prefs = "geezsys=$sysPragmaOut,frames=$frames,7-bit=$bit7,lang=$lang";

	if ( $self->{config}->{useapache} ) {
		my $cookie = new Apache::Cookie (
			$self->{apache},
			-name    => 'prefs',
			-value   => $prefs,
			-expires => $self->{config}->{cookieexpires},
			-path    => "/",
			-domain  => $self->{config}->{cookiedomain},
		);
		$cookie->bake;
	}
	else {
		print "Set-Cookie: prefs=$prefs; expires=$self->{config}->{cookieexpires}; path=/; domain=$self->{config}->{cookiedomain}\n";
	}

	$self->{cookieset} = 1;

}
#########################################################
# Do not change this, Do not put anything below this.
# File must return "true" value at termination
1;
##########################################################



( run in 1.443 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )