---
name: "SCGI::Request"
section: "3pm"
platform: "linux"
package: "libscgi-perl"
version: "0.6-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SCGI::Request"
---

# SCGI::Request(3pm)

the part of the SCGI protocol that reads the environment

## NAME

SCGI::Request - the part of the SCGI protocol that reads the environment

## SYNOPISIS

```
  # $request got from SCGI
  $request->read_env;

  read $request->connection, my $body, $request->env->{CONTENT_LENGTH};
```

## DESCRIPTION

This module implements the part of the SCGI protocol that reads the environment. All that remains after this is the content of the request. The protocol and this module guarantee that there will be a CONTENT\_LENGTH for the body of the request in the environment.

### public methods

- read\_env

  Read the environment in a blocking or non-blocking manner, per parameter to `"SCGI-"`new\>. Returns true if it has finished.

- env

  Gets the environment for this request after it has been read. This will return undef until `"read_env"` or `"sysread_env"` has been called and returned true.

- connection

  Returns the open connection to the client.

- close

  Closes the connection.

- blocking

  Returns true if the connection is blocking.

- set\_blocking

  If boolean argument is true turns on blocking, otherwise turns it off.

### private methods

- \_new

  Creates a new SCGI::Request. This is used by SCGI in the `"accept"` method, so if you are considering using this, use that instead.

- \_decode\_env

  Takes the encoded environment as a string and sets the env ready for access with `"env"`.

- \_set\_env

  Sets the environment for this request.

- \_blocking\_read\_env

  Reads and decodes the environment in one go. Returns true on success, raises an exception on failiure.

## AUTHOR

Thomas Yandell \<mailto:tom+scgi@vipercode.com\>

## 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.
