File perl-FCGI.spec of Package perl-FCGI
#
# spec file for package perl-FCGI
#
# 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 FCGI
Name: perl-FCGI
Version: 0.820.0
Release: 0
# 0.82 -> normalize -> 0.820.0
%define cpan_version 0.82
#Upstream: See the LICENSE file in this distribution for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
License: BSD-2-Clause
Summary: Fast CGI module
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/E/ET/ETHER/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(FCGI::Client) >= 0.90.0
Provides: perl(FCGI) = %{version}
Provides: perl(FCGI::Stream)
%undefine __perllib_provides
%{perl_requires}
%description
Functions:
* FCGI::Request
Creates a request handle. It has the following optional parameters:
* input perl file handle (default: \*STDIN)
* output perl file handle (default: \*STDOUT)
* error perl file handle (default: \*STDERR)
These filehandles will be setup to act as input/output/error on successful
Accept.
* environment hash reference (default: \%ENV)
The hash will be populated with the environment.
* socket (default: 0)
Socket to communicate with the server. Can be the result of the OpenSocket
function. For the moment, it's the file descriptor of the socket that
should be passed. This may change in the future.
You should only use your own socket if your program is not started by a
process manager such as mod_fastcgi (except for the FastCgiExternalServer
case) or cgi-fcgi. If you use the option, you have to let your FastCGI
server know which port (and possibly server) your program is listening on.
See remote.pl for an example.
* flags (default: FCGI::FAIL_ACCEPT_ON_INTR)
Possible values:
* FCGI::FAIL_ACCEPT_ON_INTR
If set, Accept will fail if interrupted. It not set, it will just keep on
waiting.
Example usage: my $req = FCGI::Request;
or: my %env; my $in = new IO::Handle; my $out = new IO::Handle; my $err =
new IO::Handle; my $req = FCGI::Request($in, $out, $err, \%env);
* FCGI::OpenSocket(path, backlog)
Creates a socket suitable to use as an argument to Request.
* path
Pathname of socket or colon followed by local tcp port. Note that some
systems take file permissions into account on Unix domain sockets, so
you'll have to make sure that the server can write to the created file, by
changing the umask before the call and/or changing permissions and/or group
of the file afterwards.
* backlog
Maximum length of the queue of pending connections. If a connection request
arrives with the queue full the client may receive an error with an
indication of ECONNREFUSED.
* FCGI::CloseSocket(socket)
Close a socket opened with OpenSocket.
* $req->Accept()
Accepts a connection on $req, attaching the filehandles and populating the
environment hash. Returns 0 on success. If a connection has been accepted
before, the old one will be finished first.
Note that unlike with the old interface, no die and warn handlers are
installed by default. This means that if you are not running an sfio
enabled perl, any warn or die message will not end up in the server's log
by default. It is advised you set up die and warn handlers yourself.
FCGI.pm contains an example of die and warn handlers.
* $req->Finish()
Finishes accepted connection. Also detaches filehandles.
* $req->Flush()
Flushes accepted connection.
* $req->Detach()
Temporarily detaches filehandles on an accepted connection.
* $req->Attach()
Re-attaches filehandles on an accepted connection.
* $req->LastCall()
Tells the library not to accept any more requests on this handle. It should
be safe to call this method from signal handlers.
Note that this method is still experimental and everything about it,
including its name, is subject to change.
* $env = $req->GetEnvironment()
Returns the environment parameter passed to FCGI::Request.
* ($in, $out, $err) = $req->GetHandles()
Returns the file handle parameters passed to FCGI::Request.
* $isfcgi = $req->IsFastCGI()
Returns whether or not the program was run as a FastCGI.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644
%build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc ChangeLog configure.readme README
%license LICENSE
%changelog