Lemonld...Request(3)

πŸ’– Lemonldap::NG::Common::PSGI::Request β€” the manual, but make it make sense πŸ’–

okay bestie, real talk: you've wandered into Lemonld...Request(3) from the User Contributed Perl Documentation section and you're probably like "what is this and why is it kinda hot". Sit down, hydrate, and let's get into it. 🫢


✨ NAME ✨

Lemonldap::NG::Common::PSGI::Request β€” the HTTP request object for Lemonldap::NG PSGIs. it's giving "every request that slides into your app gets wrapped in one of these". πŸ‘‘


🌸 SYNOPSIS 🌸

package My::PSGI;

use base Lemonldap::NG::Common::PSGI;

# See Lemonldap::NG::Common::PSGI
...

sub handler {
  my ( $self, $req ) = @_;
  # Do something and return a PSGI response
  # NB: $req is a Lemonldap::NG::Common::PSGI::Request object
  if ( $req->accept eq 'text/plain' ) { ... }

  return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Body lines' ] ];
}

like yes, that's the whole vibe. $req is the moment. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so this package hands you the HTTP request objects that Lemonldap::NG PSGIs use. it's got the common accessors for working with a request β€” the little grabby hands you use to poke at what came in. and bestie, it inherits from Plack::Request, so all that Plack goodness is yours too. no cap. πŸ’…


πŸŽ€ METHODS πŸŽ€

every single method from Plack::Request is available, periodt. on top of that, Lemonldap::NG::Common::PSGI::Request adds the following β€” and yes, we're doing all of them, no skips:

πŸ’œ accept

the 'Accept' header content. what the client is willing to accept from you. (emotionally? also that, sometimes.)

πŸ’œ encodings

the 'Accept-Encoding' header content.

πŸ’œ error

used to store an error value β€” usually a Lemonldap::NG::Portal::Main::Constants constant. it's the lil box where the sad news goes. 😭

πŸ’œ jsonBodyToObj

get the content of a JSON POST request as a Perl object. slurp it up, it's yours. πŸ“

πŸ’œ languages

the 'Accept-Language header content. (yes, that quote mark situation is exactly how the original has it, we don't touch the sacred text.)

πŸ’œ hostname

the 'Host' header content.

πŸ’œ read-body

okay so body() returns an IO::Handle object, which is annoying if you just want the string. this method reads and returns the request content as a string. bestie behaviour, honestly. 🫢

πŸ’œ respHeaders

accessor to the 'respHeaders' property. it stores the headers that have to be pushed into the response (peep Lemonldap::NG::Common::PSGI for that).

⚠️ careful, queen: it contains an array reference, not a hash reference, because headers can be multi-valued. don't come for me, it's just how it is.

example, because we love a demonstration:

# Set headers
$req->respHeaders( "Location" => "http://x.y.z/", Etag => "XYZ", );
# Add header
$req->respHeaders->{"X-Key"} = "Value";

πŸ’œ spliceHdrs

returns the headers array and flushes it. grab and go, no leftovers. 🧚

πŸ’œ set_param( $key, $value )

Plack::Request's param() method is read-only β€” tragic, I know. this method exists so you can actually modify a GET parameter value. glow-up unlocked. ✨

πŸ’œ uri

the REQUEST_URI environment variable, decoded.

πŸ’œ access_control_uri

the URI tested by locationRules β€” basically the path the request is really served at. handlers protecting another application set it in the "ACCESS_CONTROL_URI" environment variable (see Lemonldap::NG::Handler::Server::Main and Lemonldap::NG::Handler::ApacheMP2::Request). otherwise it's PATH_INFO, the path the LLNG router uses, followed by the query string as received. two paths, one truth. πŸ’«

πŸ’œ user

the REMOTE_USER environment variable. it contains the username when a server authentication is done. main character identification. πŸ‘‘

πŸ’œ userData

a hash reference to the session information β€” that's if the app inherits from Lemonldap::NG::Handler::PSGI or any other handler PSGI package. and if there's no session information available? it contains this:

{ _whatToTrace => <REMOTE-USER value> }

a little consolation prize. still valid, still cute. πŸŽ€

πŸ’œ wantJSON

returns true if the current request is asking for JSON content. it verifies that the "Accept" header contains "application/json" or "text/json". if it does β€” yes ma'am, JSON it is. 🌈


πŸ”₯ SEE ALSO πŸ”₯

go read these too, i'm obsessed with all of them:

  • <http://lemonldap-ng.org/>
  • Lemonldap::NG::Common::PSGI
  • Lemonldap::NG::Hander::PSGI
  • Plack::Request
  • Lemonldap::NG::Portal::Main::Constants

πŸ‘‘ AUTHORS πŸ‘‘

LemonLDAP::NG team <http://lemonldap-ng.org/team> β€” the icons who built this. πŸ’–


πŸ’€ BUG REPORT πŸ’€

found a bug or want a feature? use the OW2 system, bestie: <https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>

(not me begging you to actually file it instead of just complaining in the group chat πŸ™ˆ)


πŸ¦‹ DOWNLOAD πŸ¦‹

Lemonldap::NG is available at <https://lemonldap-ng.org/download>. go get you some. ⭐


see the COPYING file for the details, but here's the tea:

this library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

this program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU General Public License for more details. (yes, that's the shouty part. it's shouty on purpose. it means something. don't skip it. πŸ’…)

you should have received a copy of the GNU General Public License along with this program. if not, see <http://www.gnu.org/licenses/>.


and that's the whole page, bestie β€” this one was perl v5.42.3, dated 2026-09-24, straight out of the User Contributed Perl Documentation section. slay, you read the whole thing, i'm so proud of you πŸ₯Ήβœ¨πŸ’–

πŸ“¦ where this page comes from