93 lines
2.6 KiB
RPMSpec
93 lines
2.6 KiB
RPMSpec
#
|
|
# spec file for package perl-Devel-Autoflush
|
|
#
|
|
# 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/
|
|
#
|
|
|
|
|
|
%define cpan_name Devel-Autoflush
|
|
Name: perl-Devel-Autoflush
|
|
Version: 0.60.0
|
|
Release: 0
|
|
# 0.06 -> normalize -> 0.60.0
|
|
%define cpan_version 0.06
|
|
License: Apache-2.0
|
|
Summary: Set autoflush from the command line
|
|
URL: https://metacpan.org/release/%{cpan_name}
|
|
Source0: https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/%{cpan_name}-%{cpan_version}.tar.gz
|
|
Source1: cpanspec.yml
|
|
Source100: README.md
|
|
BuildArch: noarch
|
|
BuildRequires: perl
|
|
BuildRequires: perl-macros
|
|
BuildRequires: perl(IO::CaptureOutput) >= 1.08
|
|
BuildRequires: perl(version)
|
|
Provides: perl(Devel::Autoflush) = %{version}
|
|
%undefine __perllib_provides
|
|
%{perl_requires}
|
|
|
|
%description
|
|
This module is a hack to set autoflush for STDOUT and STDERR from the
|
|
command line or from 'PERL5OPT' for code that needs it but doesn't have it.
|
|
|
|
This often happens when prompting:
|
|
|
|
# guess.pl
|
|
print "Guess a number: ";
|
|
my $n = <STDIN>;
|
|
|
|
As long as the output is going to a terminal, the prompt is flushed when
|
|
STDIN is read. However, if the output is being piped, the print statement
|
|
will not automatically be flushed, no prompt will be seen and the program
|
|
will silently appear to hang while waiting for input. This might happen
|
|
with 'tee':
|
|
|
|
$ perl guess.pl | tee capture.out
|
|
|
|
Use Devel::Autoflush to work around this:
|
|
|
|
$ perl -MDevel::Autoflush guess.pl | tee capture.out
|
|
|
|
Or set it in 'PERL5OPT':
|
|
|
|
$ export PERL5OPT=-MDevel::Autoflush
|
|
$ perl guess.pl | tee capture.out
|
|
|
|
= SEE ALSO
|
|
|
|
* CPANPLUS::Internals::Utils::Autoflush -- same idea but STDOUT only and
|
|
|
|
only available as part of the full CPANPLUS distribution
|
|
|
|
%prep
|
|
%autosetup -n %{cpan_name}-%{cpan_version}
|
|
|
|
%build
|
|
perl Makefile.PL INSTALLDIRS=vendor
|
|
%make_build
|
|
|
|
%check
|
|
make test
|
|
|
|
%install
|
|
%perl_make_install
|
|
%perl_process_packlist
|
|
%perl_gen_filelist
|
|
|
|
%files -f %{name}.files
|
|
%doc Changes CONTRIBUTING README Todo
|
|
%license LICENSE
|
|
|
|
%changelog
|