Files
perl-Getopt-Euclid/perl-Getopt-Euclid.spec
2025-08-12 18:14:21 +02:00

121 lines
3.7 KiB
RPMSpec

#
# spec file for package perl-Getopt-Euclid
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_with test
%define cpan_name Getopt-Euclid
Name: perl-Getopt-Euclid
Version: 0.4.6
Release: 0
License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
Summary: Executable Uniform Command-Line Interface Descriptions
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/B/BI/BIGPRESH/%{cpan_name}-%{version}.tar.gz
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.36
BuildRequires: perl(Module::Build)
BuildRequires: perl(Pod::PlainText)
BuildRequires: perl(Pod::Select)
BuildRequires: perl(version)
Requires: perl(Pod::PlainText)
Requires: perl(Pod::Select)
Requires: perl(version)
Recommends: perl(IO::Pager::Page)
%{perl_requires}
%description
Getopt::Euclid uses your program's own POD documentation to create a
powerful command-line argument parser. This ensures that your program's
documented interface and its actual interface always agree.
The created command-line argument parser includes many features such as
argument type checking, required arguments, exclusive arguments, optional
arguments with default values, automatic usage message, ...
To use the module, simply write the following at the top of your program:
use Getopt::Euclid;
This will cause Getopt::Euclid to be require'd and its import method will
be called. It is important that the import method be allowed to run, so do
not invoke Getopt::Euclid in the following manner:
# Will not work
use Getopt::Euclid ();
When the module is loaded within a regular Perl program, it will:
* 1.
locate any POD in the same *.pl file or its associated *.pod file.
* 2.
extract information from that POD, most especially from the '=head1
REQUIRED ARGUMENTS' and '=head1 OPTIONS' sections,
* 3.
build a parser that parses the arguments and options the POD specifies,
* 4.
remove the command-line arguments from '@ARGV' and parse them, and
* 5.
put the results in the global '%ARGV' variable (or into specifically named
optional variables, if you request that -- see Exporting option variables).
As a special case, if the module is loaded within some other module (i.e.
from within a '.pm' file), it still locates and extracts POD information,
but instead of parsing '@ARGV' immediately, it caches that information and
installs an 'import()' subroutine in the caller module. This new 'import()'
acts just like Getopt::Euclid's own import, except that it adds the POD
from the caller module to the POD of the callee.
All of which just means you can put some or all of your CLI specification
in a module, rather than in the application's source file. See Module
interface for more details.
%prep
%autosetup -n %{cpan_name}-%{version}
%build
PERL_USE_UNSAFE_INC=1 %{__perl} Makefile.PL INSTALLDIRS=vendor
%make_build
%if %{with test}
%check
%make_build test
%endif
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%changelog