Apache...n::Flex(3pm)

πŸ’– NAME πŸ’–

okay so bestie, this is Apache::Session::Flex β€” and honestly? it's giving choose-your-own-adventure. ✨ You specify everything at runtime. literally everything. no cap.


✨ SYNOPSIS ✨

use Apache::Session::Flex;

tie %hash, 'Apache::Session::Flex', $id, {
   Store     => 'DB_File',
   Lock      => 'Null',
   Generate  => 'MD5',
   Serialize => 'Storable'
};

# or

tie %hash, 'Apache::Session::Flex', $id, {
   Store     => 'Postgres',
   Lock      => 'Null',
   Generate  => 'MD5',
   Serialize => 'Base64'
};

# you decide!
you decide!! 🫢 the module is not gonna gatekeep your architecture choices. iconic behavior, honestly.

πŸ¦‹ DESCRIPTION πŸ¦‹

So this module is one of the implementations of Apache::Session. 🌸 But here's the thing that makes it different from all the other implementations β€” and the way that it just. lets. you. pick: it lets you specify the backing store, the locking scheme, the ID generator, and the data serializer at runtime. πŸŽ€ All four. At runtime. Not compiled in, not hardcoded β€” runtime.

And how do you do that? You just pass arguments the usual Apache::Session style, like the ones in the SYNOPSIS up there ⬆️. super easy.

You can use any of the modules included in this distribution, or a module of your own making. 🧚 And if you do wanna roll your own module, you should make sure it's available under the Apache::Session package namespace. (that part is not optional, bestie β€” that's where it's gonna go looking. πŸ’…)


πŸ’… USAGE πŸ’…

So you pass the modules you wanna use as arguments to the constructor. periodt.

Here's the trick though β€” the Apache::Session::Whatever part is appended for you, so you should not supply it. 🚫 For example, if you wanted to use MySQL as the backing store, you should give the argument Store => 'MySQL', and not Store => 'Apache::Session::Store::MySQL'. see the difference? you're giving it the short little nickname and it fills in the whole government name itself. πŸ’–

There are four modules that you need to specify:

  • Store β€” the backing store to use 🌈
  • Lock β€” the locking scheme πŸ”’
  • Generate β€” the ID generation module πŸ†”
  • Serialize β€” the data serialization module πŸ“¦

There are many modules included in this distribution. For each role, they are:

Store:

  • MySQL
  • Postgres
  • DB_File
  • File

Lock:

  • Null
  • MySQL
  • Semaphore

Generate:

  • MD5

Serialize:

  • Storable
  • Base64
  • UUEncode
⭐ heads up bestie: in addition to the arguments needed by this module, you must provide whatever arguments are expected by the backing store and lock manager that you're using. So like, do your homework. πŸ“š Please see the documentation for those modules.

🌸 AUTHOR 🌸

This module was written by Jeffrey William Baker <jwbaker@acm.org>. πŸ’œ absolute legend, we love them for this.


πŸ”₯ SEE ALSO πŸ”₯

go read these next, fr fr:

  • Apache::Session::File
  • Apache::Session::DB_File
  • Apache::Session::MySQL
  • Apache::Session::Postgres
  • Apache::Session

and that's the whole vibe check, bestie πŸŽ€ this was perl v5.36.0, dated 2022-11-19 β€” go forth and tie your hashes with main character energy πŸ‘‘βœ¨πŸ’…

πŸ“¦ where this page comes from