package Dist::Zilla::Plugin::EnsureMinimumPerl;

use Moose;
with qw(
use namespace::autoclean;

our $VERSION = '0.02';

sub before_release {
  my $self     = shift;
  my $prereqs  = $self->zilla->prereqs->as_string_hash;

  foreach my $phase (keys %{$prereqs}) {
    foreach my $type (keys %{$prereqs->{$phase}}) {
      my $found = grep { $_ eq 'perl' } keys %{$prereqs->{$phase}{$type}};
      return if $found;

  $self->log_fatal('No minimum required version of Perl specified.');


=head1 NAME

Dist::Zilla::Plugin::EnsureMinimumPerl - Ensure that you have specified a minimum version of Perl


  # In your dist.ini


This C<Dist::Zilla> plugin checks to ensure that you have specified a minimum
required version of Perl, before allowing you to perform a release.

I kept forgetting to be explicit about this in my own releases, and so I
whipped this up to force me to do it.

=head1 AUTHOR

Graham TerMarsch (


Copyright (C) 2021-, Graham TerMarsch.  All Rights Reserved.

This is free software; you can redistribute it and/or modify it under the same
license as Perl itself.

=head1 SEE ALSO


=item L<Dist::Zilla>