perl: pretend compatibility for given ?at date
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 16 Feb 2023 14:18:54 +0000 (15:18 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 15 Apr 2023 14:34:51 +0000 (16:34 +0200)
perl.plp

index 99863ff4ed625fed79754b1f543c885174ad92aa..c36f5e8cf75c0ba9eda2112ed5d121797270fb85 100644 (file)
--- a/perl.plp
+++ b/perl.plp
@@ -32,9 +32,13 @@ eval {
        use Time::Piece;
        use Time::Seconds;
 
-       my @versions = sort keys %{$info};
        my $now = Time::Piece->new;
-       $now = $now->strptime($_, '%Y-%m-%d') for $get{at} // ();
+       if (my $ts = $get{at}) {
+               $now = $now->strptime($ts, '%Y-%m-%d');
+               say "Compatibility details emulated for <em>$ts</em>.";
+       }
+       my $ts = $now->strftime('%F');
+       my @versions = sort grep { $info->{$_}{release} le $ts } keys %{$info};
 
        # perlpolicy: «We "officially" support the two most recent stable release
        # series. [...] we will attempt to fix critical issues»