NAME

Langertha::Knarr::Session - Per-conversation state for a Knarr server

VERSION

version 1.001

DESCRIPTION

Per-conversation state object that Knarr passes to handlers. Sessions are created on demand by the Knarr core (one per unique session id seen in incoming requests) and reused across multiple turns. Handlers that need to remember state across turns store it in "handler_state"; for example Langertha::Knarr::Handler::Raider caches its per-session Langertha::Raider instance there.

id

Required. The unique session id, typically supplied by the client via the x-session-id header or extracted from a protocol-specific field.

messages

ArrayRef of message hashes, free-form for handlers that want to keep their own conversation history (most don't — Raider keeps its own).

metadata

HashRef for arbitrary per-session tags. Handlers and middlewares can read or write this without coordinating with each other.

handler_state

HashRef where decorator handlers can stash per-session state without colliding with each other. Convention: key by handler class name.

created_at

Numeric epoch seconds when the session was first seen.

last_active

Numeric epoch seconds, updated by "touch" on every request.

touch

Updates "last_active" to the current time. Called by the Knarr core on every dispatch.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-knarr/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

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