Sympa::WWW::Session(3Sympa)

πŸ’– Sympa::WWW::Session πŸ’–

okay bestie, sit down, hydrate, and let's talk about Sympa::WWW::Session from the 3Sympa manual β€” it's the Web session module, and it's basically the backstage pass that keeps track of who's who in the Sympa web interface. πŸŽ€


✨ NAME ✨

Sympa::WWW::Session β€” Web session. periodt.


🌸 SYNOPSIS 🌸

use Sympa::WWW::Session;

my $session = Sympa::WWW::Session->new($robot,
    {cookie => Sympa::WWW::Session::get_session_cookie($ENV{'HTTP_COOKIE'})}
);
$session->renew();
$session->store();

πŸ’… Confirmation

$session->confirm_action($action, 'init');

sub do_myaction {

    # Validate arguments...

    $param->{arg} = $arg;
    my $next_action = $session->confirm_action($action, $response,
        $arg, $previous_action);
    return $next_action unless $next_action eq '1';

    # Process action...

}

πŸ¦‹ DESCRIPTION πŸ¦‹

Sympa::WWW::Session hands you a web session for the Sympa web interface, no cap. You need an HTTP cookie to figure out who the user even is (like, it's the whole basis of identification, fr fr), and a session store is what keeps hold of people's personal data. πŸ”₯

🌈 Methods

  • new ( $robot, { [ cookie => $cookie ], ... } ) β€” Constructor. It makes a brand-new instance and pulls the user's data out of the session store. ✨
    • Parameters:
      • $robot β€” the context of the session.
      • { cookie => $cookie } β€” the HTTP cookie.
    • Returns: a new instance. 🫢
  • as_hashref ( ) β€” Instance method. It casts the instance into a hashref, iconic behaviour honestly.
    • Parameters: none.
    • Returns: a hashref including the attributes of the instance (peep "Attributes").
  • confirm_action ( $action, $response, [ arg => $arg, ] [ previous_action => $previous_action ] ) β€” Instance method. It checks whether an action has actually been confirmed. πŸ‘‘

Confirmation happens in two steps:

  1. You call the method with no response (aka undefined). The action, the hash of the argument, and the previous_action all get stored into the session store. Then this method returns 'confirm_action'.
  2. You call the method with 'confirm' or some other true value as the response. If the action and the hash of the argument match what's in the session store, then:
    • If 'confirm' was given, it returns 1.
    • If some other true value was given, it returns the previous action stored in the session store (and the previous_action you passed in the argument gets ignored, sorry bestie). In both cases the session store gets cleared. πŸ’€

Anytime the action submitted by the user has been determined, this method may be called with the response as 'init'. In that case, if the action doesn't match the one in the session store, the session store will be cleared.

  • Parameters:
    • $action β€” the action to be checked.
    • $response β€” response from the user: 'init', a false value (not yet checked), 'confirm', and others (cancelled). This is typically given by the user through the "response_action" parameter.
    • arg => $arg β€” the argument(s) of the action.
    • previous_action => $previous_action β€” the action users will be redirected to when the action is confirmed. This is typically given by the user through the "previous_action" parameter.
  • is_anonymous ( ) β€” Instance method. TBD. 😭 (yes, that's all it says, we simply don't know yet)
  • renew ( ) β€” Instance method. It renews the session: updates the internal session ID and the HTTP cookie. fresh start energy ✨
  • store ( ) β€” Instance method. Stores the session into the session store.

🧚 Functions

  • check_cookie_extern ( ) β€” Function. Deprecated. πŸ™ˆ
  • decrypt_session_id ( ) β€” Function. Deprecated. πŸ™ˆ
  • encrypt_session_id ( ) β€” Function. Deprecated. πŸ™ˆ
  • list_sessions ( ) β€” Function. TBD.
  • purge_old_sessions ( ) β€” Function. Deprecated. πŸ™ˆ
  • set_cookie ( $cookie_domain, $expires, [ $use_ssl ] ) β€” Instance method. TBD.
  • set_cookie_extern ( $cookie_domain, [ $use_ssl ] ) β€” Instance method. Deprecated. πŸ™ˆ
lowkey a lot of "Deprecated" up in here β€” if you're reaching for one of those, maybe don't? it's giving legacy. πŸ’€

⭐ Attributes

TBD. πŸŽ€


🌸 SEE ALSO 🌸

Sympa::DatabaseManager.


πŸ“œ HISTORY πŸ“œ

SympaSession showed up way back on Sympa 5.4a3. ✨

Then it got renamed to Sympa::Session on Sympa 6.2a.41, and after that to Sympa::WWW::Session on Sympa 6.2.26. glow-up after glow-up honestly. πŸ’…

The "confirm_action" method was added on Sympa 6.2.17.


and that's the whole page, bestie!! this was version 6.2.80, dated 2026-10-19, straight from Sympa::WWW::Session(3Sympa). mwah, take care of your sessions πŸ«ΆπŸ’–

πŸ“¦ where this page comes from