# wish, but if you redistribute a modified version, please attach a note
# listing the modifications you have made.
-$CGI::Cookie::VERSION='1.24';
+$CGI::Cookie::VERSION='1.26';
use CGI::Util qw(rearrange unescape escape);
use overload '""' => \&as_string,
# Turn on special checking for Doug MacEachern's modperl
my $MOD_PERL = 0;
if (exists $ENV{MOD_PERL}) {
- eval "require mod_perl";
- if (defined $mod_perl::VERSION) {
- my $float = $mod_perl::VERSION;
- $float = ~ s/^.+?([\d.]+).+$/$1/;
- if ($float >= 1.99) {
+ if (exists $ENV{MOD_PERL_API_VERSION} && $ENV{MOD_PERL_API_VERSION} == 2) {
$MOD_PERL = 2;
- require Apache::RequestUtil;
- eval "require APR::Table"; # Changing APIs? I hope not.
- } else {
- $MOD_PERL = 1;
- require Apache;
- }
+ require Apache2::RequestUtil;
+ require APR::Table;
+ } else {
+ $MOD_PERL = 1;
+ require Apache;
}
}
sub get_raw_cookie {
my $r = shift;
- $r ||= eval { Apache->request() } if $MOD_PERL;
+ $r ||= eval { $MOD_PERL == 2 ?
+ Apache2::RequestUtil->request() :
+ Apache->request } if $MOD_PERL;
if ($r) {
$raw_cookie = $r->headers_in->{'Cookie'};
} else {