Write a ‘flash’ helper 

hook 'before' => sub {
    %global = ( );  # Reset tokens for this request
    if( my $message = session('flash') ) {
        $global{tokens}->{flash}      = $message;
        $global{tokens}->{flash_span} = session('flash_span');
        session flash      => undef;
        session flash_span => undef;
    }
};