File: blocking.pl

package info (click to toggle)
libscgi-perl 0.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 132 kB
  • sloc: perl: 413; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl

use strict;
use warnings;

use SCGI;
use IO::Socket::INET;
use Data::Dumper;

my $socket = IO::Socket::INET->new(
  Listen => 5,
  ReuseAddr => SO_REUSEADDR,
  LocalPort => 9090
) or die "cannot bind to port 9090: $!";

my $scgi = SCGI->new($socket, blocking => 1);

while (my $request = $scgi->accept) {
  $request->read_env;
  $request->socket->print("Content-Type: text/plain\n\n");
  $request->socket->print(Dumper $request->env);
  $request->close;
}