Data::...:Static(3pm)

πŸ’– NAME πŸ’–

Data::Session::ID::Static β€” a persistent session manager, bestie. That's the whole vibe. It lives in the Data::Session family (the manual calls it Data::Session::ID::Static(3pm), Perl documentation, user contributed, iykyk).


✨ Synopsis ✨

Real talk, this page is short on purpose. For the actual details:

See Data::Session for details.

🌸 Description 🌸

So Data::Session::ID::Static lets Data::Session generate a static (aka constant) session id. It's giving "the same id, every single time, on purpose." No randomness, no drama, just consistency. πŸ’…

To use this module, do this:

  • Specify an id generator of type Static, like this:
Data::Session -> new(type => '... id:Static ...')

πŸŽ€ Case-sensitive Options πŸŽ€

Okay bestie, important: see "Case-sensitive Options" in Data::Session for the crucial info. Don't skip it, fr fr.


πŸ¦‹ Method: new() πŸ¦‹

Creates a new object of type Data::Session::ID::Static. Iconic of it.

new() takes a hash of key/value pairs, some of which might be mandatory. Also, some combinations might be mandatory. So yeah, read carefully.

The keys are listed here in alphabetical order.

They're all lower-case because they are (also) method names β€” meaning you can call them to set or get the value at literally any time. Main character energy. πŸ‘‘

  • id => $string β€” Specifies the static (constant) id to 'generate'. This key is normally passed in as Data::Session -> new(id => $string). Default: 0. This key is mandatory, and it can't be 0. (Yes, the default is 0 and it's also not allowed to be 0. That's just the lore. πŸ™ˆ)
  • verbose => $integer β€” Prints more or less information to STDERR. Typical values are 0, 1 and 2. This key is normally passed in as Data::Session -> new(verbose => $integer). This key is optional. πŸ“

🌈 Method: generate() 🌈

Generates the next session id β€” which is always whatever was passed in to new(id => ...) β€” or dies if it can't. So either you get your id or it's over. πŸ’€

Returns the new id.


⭐ Method: id_length() ⭐

Returns 32, because that's the classic value of the size of the id field in the sessions table. A legend. A classic. Periodt.

This can be used to generate the SQL to create the sessions table. So handy. 🫢


πŸ’œ Support πŸ’œ

Log a bug on RT: <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session>.


πŸ‘‘ Author πŸ‘‘

Data::Session was written by Ron Savage <ron@savage.net.au> in 2010.

Home page: <http://savage.net.au/index.html>.


Australian copyright (c) 2010, Ron Savage.

        All Programs of mine are 'OSI Certified Open Source Software';
        you can redistribute them and/or modify them under the terms of
        The Artistic License, a copy of which is available at:
        http://www.opensource.org/licenses/index.html

Okay that's the whole page, bestie. Every flag, every default, every warning β€” nothing left out, we ate that. πŸ’…βœ¨

Signing off cute: this doc is for perl v5.36.0, dated 2023-02-14. Slay, go generate some static ids. πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from