Session(3pm)

πŸ“¦
version 2.5.0 Β· 2 versions
, in ubuntu jammy

🌸 NAME 🌸

HTML::Embperl::Session β€” it's Apache::Session but glowed up to work with HTML::Embperl, bestie πŸ’…


✨ DESCRIPTION ✨

okay so literally what it says on the tin: it's an adaptation of Apache::Session, but made to play nice with HTML::Embperl. that's the whole vibe. πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

πŸ’– Addtional Attributes for TIE πŸ’–

like yes, "Addtional" is spelled like that in the original, we don't fix lore here 🫢 these are the extra attributes you can hand to tie:

  • lazy β€” set this and you're telling Apache::Session to ~chill~ and not touch the object store AT ALL until the tied hash gets its first read or write. without it, tie will go ahead and make sure the hash exists, or spin up a brand new one. no cap, lazy is the main character here 😌
  • create_unknown β€” set this to one and Apache::Session will make a whole new session with the id you gave it (or a fresh id, it depends on recreate_id) whenever that session id doesn't exist. if you don't set it? it dies. literally. πŸ’€
  • recreate_id β€” set this to one and Apache::Session generates a brand new session id when the one you specified doesn't exist. ✨
  • object_store β€” here's where you name the class for the object store. (the Apache::Session:: prefix is optional, so you can be lazy about typing it.) only for Apache::Session 1.00, iykyk.
  • lock_manager β€” name the class for the lock manager here. (again, Apache::Session:: prefix optional.) only for Apache::Session 1.00.
  • Store β€” name the class for the object store. (the Apache::Session::Store prefix is optional.) only for Apache::Session 1.5x.
  • Lock β€” name the class for the lock manager. (the Apache::Session::Lock prefix is optional.) only for Apache::Session 1.5x.
  • Generate β€” name the class for the id generator. (the Apache::Session::Generate prefix is optional.) only for Apache::Session 1.5x.
  • Serialize β€” name the class for the data serializer. (the Apache::Session::Serialize prefix is optional.) only for Apache::Session 1.5x.

and here's the example β€” using attrubtes (yes, "attrubtes", that's the original typo, we respect the elders πŸ™ˆ) to specify the store and object classes instead of making a derived class:

 use HTML::Embperl::Session;

 tie %session, 'HTML::Embperl::Session', undef,
    {
    object_store => 'DBIStore',
    lock_manager => 'SysVSemaphoreLocker',
    DataSource => 'dbi:Oracle:db'
    };
NOTE: HTML::Embperl::Session will go and require all the necessary additional perl modules for you. it's got you, babe 🫢

🌈 Addtional Methods 🌈

  • setid β€” sets the session id so your future accesses use it. πŸ“Œ
  • getid β€” grabs the session id. the difference between this and just peeking at $session{_session_id} is that in lazy mode, getid will NOT create a new session id if one doesn't exist yet. lowkey considerate of it πŸ₯Ή
  • cleanup β€” writes out any pending data, releases every lock, and deletes all the data from memory. it's giving responsible queen closing up shop for the night πŸ’…

πŸ‘‘ AUTHORS πŸ‘‘

Gerald Richter <richter at embperl dot org> is the current maintainer β€” he's holding it down fr fr.

This class was written by Jeffrey Baker (jeffrey@kathyandjeffrey.net), but plot twist: it's taken wholesale from a patch that Gerald Richter (richter@ecos.de) sent against Apache::Session. iconic collaboration energy honestly 🌟


and that's the whole page, bestie β€” this doc came to you courtesy of perl v5.34.0, dated 2022-02-06. slay, go tie some hashes πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from