#!/usr/bin/perl

use 5.006;

use strict;
use warnings;

use Getopt::Long 2.33 qw{ :config auto_version };
use Pod::Usage;
use PPIx::Regexp;

our $VERSION = '0.092';

my %opt;

GetOptions( \%opt,
    help => sub { pod2usage( { -verbose => 2 } ) },
) and @ARGV > 1 or pod2usage( { -verbose => 0 } );

my $pre = PPIx::Regexp->new( my $regexp = shift @ARGV );

foreach my $perl ( @ARGV ) {
    print $regexp, ( $pre->accepts_perl( $perl ) ? ' is' : ' is not' ),
	" accepted by $perl\n";
}


__END__

=head1 TITLE

preaccepts - See whether specified versions of Perl accept a given regular expression

=head1 SYNOPSIS

 preaccepts '/x{' 5.025 5.025001 5.026 5.027 5.027001
 preaccepts -help
 preaccepts -version

=head1 OPTIONS

=head2 -help

This option displays the documentation for this script. The script then
exits.

=head2 -version

This option displays the version of this script. The script then exits.

=head1 DETAILS

This Perl script accepts as its first argument a Perl regular
expression, and as its second and subsequent arguments Perl verions
numbers. It displays to standard out whether or not each given version
of Perl considers the specified regular expression to be correct.

The heavy lifting for this is done by the
L<PPIx::Regexp|PPIx::Regexp>
L<accepts_perl()|PPIx::Regexp::Element/accepts_perl> method.

=head1 AUTHOR

Thomas R. Wyant, III F<harryfmudd at comcast dot net>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2017-2023, 2025-2026 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl 5.10.0. For more details, see the full text
of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.

=cut

# ex: set textwidth=72 :
