Share a variable between components

On my previous posts we saw how to to create and use true global variables. Their usage is limited to $dbh at the moment. But I also need a “global” variable, shared between all components of the same request. Here’s one of my first tries, and this is how the will look like:

has 'title';
has 'authenticated_user';

<%augment wrap>
 <link rel="stylesheet" href="/static/css/style.css">
% $.Defer 
 <% inner() %>

and this is the

Welcome, <% $.authenticated_user %>
$.title("Welcome to Sentosa");

I think I will use and here’s what I’m going to do:

has 'authenticated_user';
has 'title';

method wrap() {
 $.authenticated_user ("Superuser");

Next, how do I actually authenticate my users? See it on my next post!

Written on August 10, 2015