browser: record modified date at caniuse retrieval
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 13 Dec 2010 20:26:28 +0000 (21:26 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 21:40:44 +0000 (22:40 +0100)
tools/convert-caniuse.pl

index 5f619b11178a7e464a6eb263616a9df5beed9a62..b00a869b2a94094fa06138016b46f5b8c4fad819 100755 (executable)
@@ -28,10 +28,12 @@ if (@ARGV) {
        my $data = decode_json($res->decoded_content) or die "Parse error: $!";
        my $updated = eval {
                s/ GMT$//,
-               return Time::Piece->strptime($_)->ymd for $res->header('Last-Modified')
-       } || time;
+               return Time::Piece->strptime($_) for $res->header('Last-Modified')
+       };
+       $data->{-date} = $_->datetime for $updated || ();
 
-       open my $save, '>', (my $download = "browser-support-$updated.inc.pl");
+       my $suffix = $updated && $updated->ymd || time;
+       open my $save, '>', (my $download = "browser-support-$suffix.inc.pl");
        print {$save} pp($data);
        close $save;