docs::a...ionUtil(3)
π¦ NAME π¦
Apache2::ConnectionUtil β the Perl API for Apache connection utils, bestie. It's the little helper that gives you connection-record goodies. π
β¨ Synopsis β¨
okay so here's the whole vibe, literally copy this:
use Apache2::Connection ();
use Apache2::ConnectionUtil ();
use Apache2::RequestRec ();
# grab the connection object;
my $c = $r->connection;
# share perl objects like $r->pnotes
$old_val = $c->pnotes($key => $value);
That's it. That's the whole thing. You grab your connection object, and then you can share perl objects the same way $r->pnotes does it. Slay. π
πΈ Description πΈ
Apache2::ConnectionUtil provides the Apache connection record object utilities API. That's the assignment, and it ate. β¨
π API π
Apache2::ConnectionUtil provides the following functions and/or methods (pnotes is the main character here, iykyk):
π«Ά pnotes
Share Perl variables between requests over the lifetime of the connection. Not the request β the connection. This is the important part, don't forget it. π₯
$old_val = $c->pnotes($key => $val);
$val = $c->pnotes($key);
$hash_ref = $c->pnotes();
- obj:
$c( anApache2::Connection object) β the invocant, your connection bestie. - opt arg1:
$key( string ) β a key value. - opt arg2:
$val( SCALAR ) β any scalar value (e.g. a reference to an array). Literally any scalar, no cap. - ret: (3 different possible values) β it's giving choose-your-own-adventure:
- if both,
$keyand$valare passed, the previous value for$keyis returned if such existed, otherwiseundefis returned. - if only
$keyis passed, the current value for the given key is returned. - if no arguments are passed, a hash reference is returned, which can then be directly accessed without going through the
pnotes()interface. π§
- if both,
- since:
2.0.3
See ("Apache2::RequestUtil::pnotes") for the details of the pnotes method usage. The usage is identical except for a few differences β and omg the differences matter:
- First is the use of
$cinstead of$ras the invocant. Different letter, different whole object. π - The second is that the data persists for the lifetime of the connection instead of the lifetime of the request. So if the connection is lost, so is the data stored in
pnotes. Gone. Poof. π«§
β οΈ fr fr read that again: connection goes bye-bye β your pnotes data goes bye-bye too. Not a request-scoped thing, a connection-scoped thing. Vibe check your architecture accordingly. π
π See Also π
Apache2::Connection.Apache2::RequestUtil::pnotes.- mod_perl 2.0 documentation.
π Copyright π
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
π Authors π
The mod_perl development team and numerous contributors.
okay bestie that's the whole page, you're officially a connection-util expert now π₯³ β this iconic little number was brought to you by perl v5.42.3, dated 2023-10-21, and filed under docs::a...ionUtil(3). periodt. π
π¦ where this page comes from
- nixos 26.05: mod_perl 2.0.13
- nixpkgs unstable: mod_perl 2.0.13
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms