Skip to content

Commit cf0b6d5

Browse files
bmwiedemannoalders
authored andcommitted
Fix t/issue32.t on old perl versions
perl < 5.12 had a year2038 bug, so instead we just use the next year as expiry so that it will pass at least until 2036 and until then people should be on newer versions and possibly even 64-bit platforms so that this will not be a problem. This does not adjust the weekday, but apparently nobody checks it. Fixes #58
1 parent 544cdeb commit cf0b6d5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/issue32.t

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ use HTTP::Cookies;
66
use HTTP::Request;
77
use HTTP::Response;
88

9+
my $nextyear = 1901+(gmtime())[5];
10+
911
my $req = HTTP::Request->new(GET => "http://example.com");
10-
my $resp = HTTP::Response->new(200, 'OK', ['Set-Cookie', q!a="b;c;\\"d"; expires=Fri, 06-Nov-2999 08:58:34 GMT; domain=example.com; path=/!]);
12+
my $resp = HTTP::Response->new(200, 'OK', ['Set-Cookie', q!a="b;c;\\"d"; expires=Fri, 06-Nov-! . $nextyear . " 08:58:34 GMT; domain=example.com; path=/"]);
1113
$resp->request($req);
1214

1315
my $c = HTTP::Cookies->new;
1416
$c->extract_cookies($resp);
15-
is $c->as_string, 'Set-Cookie3: a="b;c;\"d"; path="/"; domain=example.com; path_spec; expires="2999-11-06 08:58:34Z"; version=0' . "\n";
17+
is $c->as_string, 'Set-Cookie3: a="b;c;\"d"; path="/"; domain=example.com; path_spec; expires="' . $nextyear . '-11-06 08:58:34Z"; version=0' . "\n";
1618

1719
# test the implementation of the split function in isolation.
1820
# should probably name the function better too.

0 commit comments

Comments
 (0)