Dancer2...ry::File(3)
π NAME π
Dancer2::Core::Role::SessionFactory::File β it's giving role for file-based session factories, bestie β¨
πΈ VERSION πΈ
version 2.2.1 π
π¦ DESCRIPTION π¦
okay so. this is a specialized SessionFactory role, and its whole ~thing~ is storing session data in files. that's it. that's the vibe. πβ¨
the role is the one doing all the heavy lifting with the files themselves, fr fr. classes that consume it? they only gotta handle serialization and deserialization. like, you bring the data-in-and-out, this role brings the file management. teamwork. π«Ά
now, if you're a class consuming this, you must satisfy three requirements, no cap, all three, periodt:
_suffix_freeze_to_handle_thaw_from_handle
here's the whole lil blueprint so you can see exactly what we mean π
package Dancer2::Session::XYX;
use Dancer2::Core::Types;
use Moo;
has _suffix => (
is => 'ro',
isa => Str,
default => sub { '.xyz' },
);
with 'Dancer2::Core::Role::SessionFactory::File';
sub _freeze_to_handle {
my ($self, $fh, $data) = @_;
# ... do whatever to get data into $fh
return;
}
sub _thaw_from_handle {
my ($self, $fh) = @_;
my $data;
# ... do whatever to get data from $fh
return $data;
}
1;
see how clean that is?? iconic. you define your _suffix, you pull in the role with with, and you write your two lil handle functions. that's the whole assignment. π
β¨ ATTRIBUTES β¨
π session_dir
where the session files get stored. it defaults to "./sessions" if you don't say otherwise. yes, it'll just make a sessions folder right where you're standing. minding its own business. πΈ
π AUTHOR π
Dancer Core Developers β the actual legends π«Ά
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2026 by Alexis Sukrieh.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay π
and that's the whole page, bestie!! π this was perlv5.42.3, dated2026-09-20, and it lives in the User Contributed Perl Documentation section, iykyk πβ¨ bye ily π¦
π¦ where this page comes from
- fedora 44: perl-Dancer2 2.2.1-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms