HTML::...stToken(3pm)
π HTML::...stToken(3pm) β User Contributed Perl Documentation π
okay bestie, sit down, hydrate, because we're talking about HTML::FormFu::Element::RequestToken and it's honestly iconic. this is the perl doc page for it, straight from the user-contributed perl documentation, and i'm gonna walk you through every single crumb. no skipping. periodt.
β¨ VERSION β¨
version 2.04 β that's the one, that's the era we're living in. π
β¨ SYNOPSIS β¨
the little taste test, the vibe check, the "here's how you'd actually use it":
my $e = $form->element( { type => 'Token' } );
my $p = $form->element( { plugin => 'Token' } );
see? two ways in. one as an element (type => 'Token'), one as a plugin (plugin => 'Token'). pick your fighter π«Ά
β¨ DESCRIPTION β¨
okay so this field? it's a bouncer. πͺ a little bodyguard for your form. it can prevent CSRF attacks, which is a whole category of "someone else is pretending to be you and submitting your forms" nonsense.
how does it do it? it holds a random token. and then, after the form gets submitted, that token gets checked against the token that's stored in the session of the current user. if they match, you're in. if they don't β nope, not today. π
and if you want a convenient way to actually wire this up, go look at "request_token_enable" in Catalyst::Controller::HTML::FormFu. it makes the whole thing way less annoying, iykyk. πΈ
β¨ NAME β¨
HTML::FormFu::Element::RequestToken β a hidden text field which contains a unique token. that's the whole elevator pitch. short, sweet, slays. β¨
β¨ ATTRIBUTES β¨
π context
this is the value of the stash key for the Catalyst context object β you know, the $c. defaults to "context".
π expiration_time
time to life for a token, in seconds. yes, "time to life," that's what the original says, we don't rewrite the lore. defaults to 3600.
π session_key
the session key used to store the tokens. defaults to "__token". π
π limit
caps how many tokens get kept in the session. defaults to 20. like a guest list, but for tokens.
π constraints
defaults to HTML::FormFu::Constraint::RequestToken and HTML::FormFu::Constraint::Required. two of them. a duo. a dynamic. π
π message
sets the error message. that's it, that's the whole description. your words, your vibe. π
β¨ METHODS β¨
π expire_token
this method looks in the session for expired tokens and removes them. it's giving spring cleaning. it's giving blocking-and-deleting. π§Ή
π get_token
generates a new token and stores it in the stash. brand new token, fresh out the oven. π
π verify_token
checks whether a given token is already in the session. returns 1 if it exists, 0 otherwise. yes/no, in/out, iconic binary energy. β¨
β¨ SEE ALSO β¨
go read these next, they're the friend group:
Catalyst::Controller::HTML::FormFuHTML::FormFu::Plugin::RequestTokenHTML::FormFu::Constraint::RequestTokenHTML::FormFu
β¨ AUTHOR β¨
Moritz Onken, "onken@houseofdesign.de" β thank you for your service π«‘
β¨ LICENSE β¨
this library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. so like. go off. π
β¨ AUTHORS β¨
- Carl Franks <cpan@fireartist.com>
- Nigel Metheringham <nigelm@cpan.org>
- Dean Hamstead <dean@bytefoundry.com.au>
the trio. the main characters. π
β¨ COPYRIGHT AND LICENSE β¨
this software is copyright (c) 2007-2018 by Carl Franks / Nigel Metheringham / Dean Hamstead.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
aaaand that's the whole page bestie, no cap, every crumb accounted for. πβ¨
perl v5.36.0 Β· 2022-12-06 β that's the source and the date, mwah, and this doc for HTML::...stToken(3pm) is officially done. slay, go build something safe, drink water, ily π«Άπ
π¦ where this page comes from
- debian bookworm: libcatalyst-controller-html-formfu-perl 2.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-controller-html-formfu-perl 2.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-controller-html-formfu-perl 2.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-controller-html-formfu-perl 2.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-controller-html-formfu-perl 2.04-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms