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::PSGILemonldap::NG::Hander::PSGIPlack::RequestLemonldap::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. β
πΈ COPYRIGHT AND LICENSE πΈ
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
- fedora 43: lemonldap-ng-common 2.23.4-1.fc43 Β· GPL-2.0-or-later AND MIT AND GPL-3.0-or-later AND OFL-1.1-RFN
- fedora 44: lemonldap-ng-common 2.23.4-1.fc44 Β· GPL-2.0-or-later AND MIT AND GPL-3.0-or-later AND OFL-1.1-RFN
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms