Cataly...::File(3pm)

πŸ“¦
version 0.18 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Catalyst::Plugin::Session::Store::File β€” aka the page you're on, Cataly...::File(3pm), from the User Contributed Perl Documentation corner of the universe πŸ’– β€” is the file storage backend for session data. That's it. That's the job. Slay.


🌸 SYNOPSIS 🌸

use Catalyst qw/Session Session::Store::File Session::State::Foo/;

MyApp->config->{'Plugin::Session'} = {
    storage => '/tmp/session'
};

# ... in an action:
$c->session->{foo} = 'bar'; # will be saved

bestie look how easy that is. you set a key in $c->session and it just… gets saved. no cap. ✨


πŸ’… DESCRIPTION πŸ’…

Catalyst::Plugin::Session::Store::File is an easy to use storage plugin for Catalyst that uses an simple file to act as a shared memory interprocess cache. And yes, it's based on Cache::FileCache. iconic behavior honestly 🫢

πŸŽ€ METHODS πŸŽ€

  • get_session_data
  • store_session_data
  • delete_session_data
  • delete_expired_sessions

okay so these four? these are implementations of the required methods for a store. the whole squad. if you wanna read the contract they're fulfilling, go see Catalyst::Plugin::Session::Store.

  • setup_session

this one sets up the session cache file. the setup girlie. she's doing the prep work so the rest can vibe 🌈


⭐ CONFIGURATION ⭐

these parameters get placed in the hash under the Plugin::Session key in the configuration hash. put them there or they simply will not find you πŸ™ˆ

  • storage β€” specifies the directory root to be used for the sharing of session data. if you don't set it, the default value will use File::Spec to find the default tempdir, and then use a file named MyApp/session/data, where MyApp is replaced with the appname.
heads up bestie: note that the file will be created with mode 0640, which means that it will only be writeable by processes running with the same uid as the process that creates the file. If this may be a problem, for example if you may try to debug the program as one user and run it as another, specify a directory like /tmp/session-$>, which includes the UID of the process in the filename. lowkey a lifesaver 🫑
  • relative β€” makes the storage path relative to $c-path_to>
  • namespace β€” the namespace associated with this cache. defaults to an empty string if not explicitly set. If set, the session data will be stored in a directory called MyApp/session/data/<namespace">. yes the whole directory glow-up πŸ’œ
  • cache_depth β€” the number of subdirectories deep to session object item. This should be large enough that no session directory has more than a few hundred objects. Defaults to 3 unless explicitly set.
  • directory_umask β€” the directories in the session on the filesystem should be globally writable to allow for multiple users. While this is a potential security concern, the actual cache entries are written with the user's umask, thus reducing the risk of cache poisoning. If you desire it to only be user writable, set the 'directory_umask' option to '077' or similar. Defaults to '000' unless explicitly set. not me telling you to lock it down if you're feeling cautious πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

  • Catalyst
  • Catalyst::Plugin::Session
  • Cache::FileCache

the whole friend group. go say hi πŸ¦‹


πŸ’– AUTHOR πŸ’–

Sascha Kiefer, esskar@cpan.org


Copyright (C) 2005 Sascha Kiefer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, babe. it came to you courtesy of perl v5.34.0, dated 2022-06-09, living its best life as Cataly...::File(3pm) in the User Contributed Perl Documentation. mwah. πŸ’‹ periodt. πŸŽ€

πŸ“¦ where this page comes from