Write a ‘title’ helper 

hook 'before_template_render' => sub {
    my $tokens = shift;

    # ...
    while(my($key, $value) = each %$global_tokens) {
        $tokens->{$key} = $value unless exists $tokens->{$key};
    }
    $tokens->{'set_title'} = \&set_title;
    $tokens->{'title'}     = \&title;
};