Starch::Plugin::CookieArgs - Arguments and methods for dealing with HTTP cookies.
my $starch = Starch->new( plugins => ['::CookieArgs'], cookie_name => 'my_session', ..., ); my $state = $starch->state(); my $cookie_args = $state->cookie_args(); print $cookie_args->{name}; # my_session
This plugin adds new arguments to the manager class and new methods to the state class which are intended to ease the integration of Starch with existing web frameworks.
These arguments are added to the Starch::Manager class.
A detailed description of what these arguments mean and what they can contain is in the CGI::Simple::Cookie documentation.
The name of the session cookie, defaults to session.
session
The domain name to set the cookie to. Set this to undef, or just don't set it, to let the browser figure this out.
The path within the "cookie_domain" that the cookie should be applied to. Set this to undef, or just don't set it, to let the browser figure it out.
Whether the session cookie can only be transmitted over SSL. This defaults to true, as doing otherwise is a pretty terrible idea as a user's session cookie could be easily hijacker by anyone sniffing network packets.
If this is set to true then JavaScript will not have access to the cookie data, mitigating certain XSS attacks. This defaults to true as having JavaScript that needs access to cookies is a rare case and you should have to explicitly declare that you want to turn this protection off.
These methods are added to the Starch::State class.
Returns "cookie_delete_args" if the "is_deleted" in Starch::State, otherwise returns "cookie_set_args".
These args are meant to be compatible with "CGI::Simple::Cookie", minus the - in front of the argument names, which is the same format that Catalyst accepts for cookies.
-
Returns a hash ref containing all the cookie args including the value being set to "id" in Starch::State and the expires being set to "expires" in Starch::State.
This returns the same thing as "cookie_set_args", but overrides the expires value to be one day in the past which will trigger the client to remove the cookie immediately.
expires
See "AUTHOR" in Starch, "CONTRIBUTORS" in Starch, and "LICENSE" in Starch.
To install Starch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Starch
CPAN shell
perl -MCPAN -e shell install Starch
For more information on module installation, please visit the detailed CPAN module installation guide.