The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Доброго всем

Mojolicious::Plugin::RoutesAuthDBI::Guest

¡ ¡ ¡ ALL GLORY TO GLORIA ! ! !

NAME

Mojolicious::Plugin::RoutesAuthDBI::Guest - session for guests. Store guests in separate DBI table.

SYNOPSIS

    $app->plugin('RoutesAuthDBI', 
        ...
        guest => {< hashref options list below >},
        ...
    );

OPTIONS

namespace

String, default to 'Mojolicious::Plugin::RoutesAuthDBI'.

module

String, default to 'Guest' (this module).

session_key

String, session storage of guest data. Default to 'guest_data'.

tables

Hashref, any DB tables names. See Mojolicious::Plugin::RoutesAuthDBI::Schema#Default-variables-for-SQL-templates.

table

String, DB table guests name. See Mojolicious::Plugin::RoutesAuthDBI::Schema#Default-variables-for-SQL-templates.

METHODS

current($controller)

Get current guest hashref by session and undef overwise.

  my $guest = $c->access->plugin->guest->current($c);

store($controller, $data)

Store guest data in DB table and set session_key. Headers of request save in "data" column.

  $c->access->plugin->guest->store($c, {"Glory"=>"is ♥ for me"});

is_guest($controller)

True if current session of guest.

  if( $c->access->plugin->guest->is_guest($c) ) {...}

load($id)

Loads guest data from DB table by its ID row. JSON column "data" will expand.

  my $data = $c->access->plugin->guest->load($id);

reload($controller)

Cleanup stash and reload guest data.

  my $guest = $c->access->plugin->guest->reload($c);

SEE ALSO

Mojolicious::Plugin::Authentication

AUTHOR

Михаил Че (Mikhail Che), <mche [on] cpan.org>

BUGS / CONTRIBUTING

Please report any bugs or feature requests at https://github.com/mche/Mojolicious-Plugin-RoutesAuthDBI/issues. Pull requests welcome also.

COPYRIGHT

Copyright 2016+ Mikhail Che.

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