Lemonld...SGI::Try(3)
π Lemonldap::NG::Handler::PSGI::Try(3) π
okay bestie, gather round, because this one is from the User Contributed Perl Documentation section and it is lowkey the most main character handler in the whole Lemonldap::NG lineup. it's giving "portal energy" and we are obsessed π
β¨ NAME β¨
Lemonldap::NG::Handler::PSGI::Try</p> β a special handler for the Lemonldap::NG Portal. no cap, that's literally its whole job description π«Ά
πΈ SYNOPSIS πΈ
here's the vibe, in code, verbatim, don't touch a single character:
package My::PSGI;
use base Lemonldap::NG::Handler::PSGI::Try;
sub init {
my ($self,$args) = @_;
# Declare REST routes for authenticated users (could be HTML templates or
# methods)
$self->addAuthRoute ( 'index.html', undef, ['GET'] )
->addAuthRoute ( books => { ':book' => 'booksMethod' }, ['GET', 'POST'] );
# Default route (ie: PATH_INFO == '/')
$self->defaultAuthRoute('index.html');
# Same for unauthenticated users
$self->addUnauthRoute ( 'login.html', undef, ['GET'] )
->addUnauthRoute ( 'login', undef, ['POST'] );
$self->defaultUnauthRoute('login.html');
# Return a boolean. If false, then error message has to be stored in
# $self->error
return 1;
}
sub booksMethod {
my ( $self, $req, @otherPathInfo ) = @_;
# Will be called only if authorized
my $userId = $self->userId;
my $book = $req->params('book');
my $method = $req->method;
...
$self->sendJSONresponse(...);
}
like, look at that chained ->addAuthRoute situation. the way she just stacks routes. iconic behavior fr fr π
π¦ DESCRIPTION π¦
so Lemonldap::NG::Handler::PSGI::Try is a Lemonldap::NG::Handler::PSGI::Router package, and what she does is serve up 2 REST routers: one for the authenticated girlies and one for the unauthenticated girlies. two doors, two vibes, one handler. slay β¨
π METHODS π
basically the same as Lemonldap::NG::Handler::PSGI::Router (she inherits from Lemonldap::NG::Common::PSGI::Router, generational wealth tbh) β except for these two glow-ups:
addRoute()must be replaced byaddAuthRoute()oraddUnauthRoute()β pick your lane bestie, there's no neutral route here πdefaultRoute()must be replaced bydefaultAuthRoute()ordefaultUnauthRoute()β same energy, just gendered by auth status π
also note (and this is the good part): user session datas are available in the $req parameter β that's the first argument received by REST methods π
and specifically:
$req->userData()returns a hash reference containing user session data. yes, a hash reference. the whole little treasure chest. go off π
π SEE ALSO π
peep Lemonldap::NG::Common::PSGI::Router for more. she's the blueprint, the origin story, the blueprint of the blueprint π§
π AUTHORS π
the LemonLDAP::NG team <http://lemonldap-ng.org/team> β collectively carrying this entire project on their backs, no big deal π«Ά
π BUG REPORT π
got beef with a bug? wanna request a feature? use the OW2 system, bestie: <https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/issues>
they will read it. drop the issue. π
π₯ DOWNLOAD π₯
Lemonldap::NG is available at <https://lemonldap-ng.org/download> β go get her πββοΈπ¨
π COPYRIGHT AND LICENSE π
see the COPYING file for details, she has receipts.
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, or (at your option) any later version. so generous of her π
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. yeah that part is shouting, it means it, do not come for her if it breaks π
you should have received a copy of the GNU General Public License along with this program. if not, see <http://www.gnu.org/licenses/>.
ok that's the whole page, every flag, every route, every legal line, all of it, nothing skipped, periodt π
signing off, mwah π β this was perl v5.42.3, dated 2026-09-24, filed under the ever-so-mysterious Lemonld...SGI::Try(3) (the terminal truncates her name but she knows exactly who she is) π¦β¨
π¦ where this page comes from
- fedora 43: lemonldap-ng-handler 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-handler 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