SCGI(3pm)
π SCGI π
okay bestie, so this is SCGI, section 3pm of the User Contributed Perl Documentation β and it's literally the whole toolkit for building an SCGI interface for an application server. no cap. π¦
β¨ NAME β¨
SCGI β for implementing an SCGI interface for an application server π
πΈ SYNOPSIS πΈ
use SCGI;
use IO::Socket;
my $socket = IO::Socket::INET->new(Listen => 5, ReuseAddr => 1, LocalPort => 8080)
or die "cannot bind to port 8080: $!";
my $scgi = SCGI->new($socket, blocking => 1);
while (my $request = $scgi->accept) {
$request->read_env;
read $request->connection, my $body, $request->env->{CONTENT_LENGTH};
#
print $request->connection "Content-Type: text/plain\n\nHello!\n";
}
π DESCRIPTION π
π public methods π
newβ takes a socket and then a set of options (key value pairs, iykyk) and hands you back a brand newSCGIlistener. rn the only option that's supported isblocking, and it's there to say "yeah this socket blocks and the library should not treat it accordingly". by defaultblockingis false. (β οΈ NOTE:blockingis now a named rather than a positional parameter. if you use it as a positional parameter you'll get a warning in this version, and it will throw an exception in the next version. so likeβ¦ fix it now bestie π)acceptβ accepts a connection from the socket and returns anSCGI::Requestfor it. that's it, that's the function π«Άsocketβ returns the socket that was passed to the constructor. giving "where did you come from" energy but in a helpful way β¨blockingβ returns true if it was indicated that the socket should be blocking when theSCGIobject was created. just a lil boolean check, no drama π
π KNOWN ISSUES π
the SCGI Apache2 module had a bug (for me at least π) which resulted in segmentation faults. it appeared after version 1.2 (the version in Debian Sarge) and was fixed in 1.10. we love a glow-up π
the SCGI Apache2 module also has a bug where certain headers can be repeated. this one is still there in version 1.10. a patch has been accepted and this issue should be resolved in the next release. this module now issues a warning on a repeated header, rather than throwing an exception like it did in the previous version. progress, honestly π
π AUTHOR π
Thomas Yandell <mailto:tom+scgi@vipercode.com> β iconic, we stan π«Ά
π COPYRIGHT π
Copyright 2005, 2006 Viper Code Limited. All rights reserved.
πΈ LICENSE πΈ
This file is part of SCGI (perl SCGI library).
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
periodt. that's the whole page, bestie. go build something slay with it π β¨
okay so the boring-but-important receipt at the bottom: this is from perl v5.36.0, dated 2022-10-13, and the page is SCGI(3pm). not me ending the whole thing with the version numbers like a true main character πππ¦
π¦ where this page comes from
- ubuntu noble: libscgi-perl 0.6-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libscgi-perl 0.6-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libscgi-perl 0.6-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms