libapa...ionUtil(3pm)

✨ NAME ✨

Apache2::ConnectionUtil β€” it's the Perl API for Apache connection utils, bestie πŸ’… (it lives in the User Contributed Perl Documentation section, manual page libapa...ionUtil(3pm), if you were wondering where you wandered in from)


🌸 Synopsis 🌸

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);

πŸ¦‹ Description πŸ¦‹

Apache2::ConnectionUtil hands you the utilities API for the Apache connection record object. That's the whole vibe. It's giving "connection-level goodies" πŸ”₯


πŸ’– API πŸ’–

Here's everything Apache2::ConnectionUtil gives you, no gatekeeping:

πŸŽ€ pnotes

Share Perl variables between requests over the lifetime of the connection. Yes, the connection, not just one request β€” she persists πŸ‘‘

$old_val  = $c->pnotes($key => $val);
$val      = $c->pnotes($key);
$hash_ref = $c->pnotes();
  • obj: $c ( an Apache2::Connection object ) β€” your main character ✨
  • opt arg1: $key ( string ) β€” a key value
  • opt arg2: $val ( SCALAR ) β€” any scalar value (e.g. a reference to an array). Live your life, it's flexible πŸ’…
  • ret: three different possible values, and which one you get depends on what you handed her:
    • if both $key and $val are passed, the previous value for $key is returned if such existed β€” otherwise undef comes back at you 😭
    • if only $key is passed, the current value for the given key is returned
    • if no arguments are passed, a hash reference is returned, which you can then directly access without going through the pnotes() interface. Sneaky shortcut, we love her 🫢
  • since: 2.0.3
Peep Apache2::RequestUtil::pnotes for the full details on how the pnotes method works β€” the usage is identical except for a couple of differences. First one: you use $c as the invocant instead of $r. Second one: the data persists for the lifetime of the connection instead of the lifetime of the request. So like, if the connection is lost, so is the data stored in pnotes. Gone. Poof. πŸ’€ Not recoverable, so don't get attached.

🌈 See Also 🌈

  • Apache2::Connection.
  • Apache2::RequestUtil::pnotes.
  • mod_perl 2.0 documentation.

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. (The collective, fr fr 🌟)


That's the whole page, babes β€” brought to you by perl v5.42.3, stamped 2026-08-20. Go forth and share your connection pnotes responsibly πŸŽ€πŸ’–

πŸ“¦ where this page comes from