set#
Assign $value to a template variable named as for get, creating the hashes on the way; with a true fourth argument, only when the variable is not already true. Returns the value assigned, or an empty string when nothing was.
Synopsis#
$stash->set('title', 'Home');
$stash->set('user.mail', 'ann@example.org'); # creates user if needed
$stash->set('title', 'Default', 1); # only if not already true
Edge cases#
A reference other than a list ref as
$identdies “Template::Stash::XS: set (arg 2) must be a scalar or listref”.Names starting with
_or.are private and are not assigned while$Template::Stash::PRIVATEis true.The last element on an object calls its method with
$valueas the last argument.