diff --git a/lib/Pingback.pm b/lib/Pingback.pm index 3d6391f5..f2e0adb4 100644 --- a/lib/Pingback.pm +++ b/lib/Pingback.pm @@ -176,6 +176,7 @@ sub _touch { sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK or die "Cannot create $file : $!"; close $fh or die "Cannot close $file : $!"; + utime(undef, undef, $file); } sub encode_client_response { diff --git a/t/lib/Pingback.t b/t/lib/Pingback.t index 60fc3bb8..ab08af9a 100644 --- a/t/lib/Pingback.t +++ b/t/lib/Pingback.t @@ -215,6 +215,11 @@ ok( "time_to_check returns true if the file exists and it's mtime is at least one day old", ); +ok( + !Pingback::time_to_check($file), + "...but fails if tried a second time, as the mtime has been updated", +); + # ############################################################################# # Done. # #############################################################################