Mason2, share a variable to sub-components, need to use globals?
Federico Thiella <[email protected]> Sun, 21 Jun 2015 17:38:16 +0200
| Newsgroups | gmane.comp.web.mason.user |
|---|---|
| Message-ID | <CAEzMO=A0NF84r2R5d40-mR_fM=8X-_tiAwxRXGEeaFtC0dky1Q@mail.gmail.com> |
--===============5256203299563650611==
Content-Type: multipart/alternative; boundary=f46d04426b98247866051908f2c7
--f46d04426b98247866051908f2c7
Content-Type: text/plain; charset=UTF-8
Long time ago I did some nice projects using HTML::Mason for our Intranet
that had lot of success :)
Now I want to create some new projects using Poet + Mason2.
I'm trying to understand how to share a variable to subcomponents. Suppose
I have this Base.pm component:
my $user = 'Guest'
method wrap() {
inner();
}
how can I make this $user variable accessible to all subcomponents?
For example, in Base.mc or in index.mc I would perform different actions if
the user is a guest or not.
In Mason1 I used to have global shared variables, but is this still
considered good practice in Mason2?
--f46d04426b98247866051908f2c7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Long time ago I did some nice projects using HTML::Mason f=
or our Intranet that had lot of success :)<div><br></div><div>Now I want to=
create some new projects using Poet + Mason2.<br></div><div><br></div><div=
>I'm trying to understand how to share a variable to subcomponents. Sup=
pose I have this Base.pm component:</div><div><br></div><div>my $user =3D &=
#39;Guest'</div><div><br></div><div>method wrap() {<br></div><div><div>=
=C2=A0 inner();</div><div>}</div></div><div><br></div><div>how can I make t=
his $user variable accessible to all subcomponents?</div><div><br></div><di=
v>For example, in Base.mc or in <a href=3D"http://index.mc">index.mc</a> I =
would perform different actions if the user is a guest or not.</div><div><b=
r></div><div>In Mason1 I used to have global shared variables, but is this =
still considered good practice in Mason2?</div></div>
--f46d04426b98247866051908f2c7--
--===============5256203299563650611==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
------------------------------------------------------------------------------
--===============5256203299563650611==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users
--===============5256203299563650611==--