SCGI(3pm)

πŸ“¦
version 0.6 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 new SCGI listener. rn the only option that's supported is blocking, and it's there to say "yeah this socket blocks and the library should not treat it accordingly". by default blocking is false. (⚠️ NOTE: blocking is 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 an SCGI::Request for 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 the SCGI object 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 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