#!/usr/bin/env perl use 5.010; use strict; use warnings; use Data::Dump 'pp'; use JSON; use File::stat; use Time::Piece; our $VERSION = '1.01'; local $/; # slurp my $source = readline; $JSON::PP::false = 0; $JSON::PP::true = 1; my $data = from_json($source); my $update = eval { stat(${^LAST_FH} // $ARGV)->mtime } or warn "Could not determine input time\n"; $data->{-date} = Time::Piece->new($update)->datetime; say "# automatically generated by $0"; print '+', pp($data); __END__ =head1 NAME mkcaniuse - Turn Javascript data into an equivalent Perl structure =head1 SYNOPSIS tools/mkcaniuse data.json >browser-support.inc.pl