Neil,
first of all it would be possible. Because more people already run across
this problem (even without EmbperlObject), I have somewhere in my mind the
idea of an export or share parameter for Execute, something like
Execute ({inputfile => '*', export => ['$foo', '@bar']}) ;
then $foo and @bar will be exported in the called package. So you can
access
them from both packages like a normal global variable.
Would this solve your problem, or do you think adding this parameter to
every Execute would mean to much overhead for you ?
It would allow a finer control about what is accessable from where, then a
%global hash or something similar.
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
>
> ----- Original Message -----
> From: "Neil Gunton" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, February 09, 2001 6:02 PM
> Subject: (possibly stupid) idea for EmbperlObject variables
>
>
> > Hi Gerald,
> >
> > I had an idea regarding the issue of having variables which are visible
> > to all pages in any request. Currently we get a Request object passed in
> > on the stack, which we can set variables in. However I have found this
> > to be rather inconvenient due to the extra syntax involved with
> > accessing such variables. For instance instead of $foo we now have
> > $req->{foo}. As a result I currently include files from base.html into
> > the same package. This enables me to have simple variables which are
> > shared between files.
> >
> > However, there are potential problems with using the same package, and
> > it also short circuits the inheritance mechanisms.
> >
> > Here's the idea: We currently get certain variables made available to
> > each page, such as %fdat. What if there was an object similar to (but
> > not the same as) $req, where we could set variables; call it, say,
> > $global. Then, we have $global passed in on the stack (like $req). But
> > in addition, we also get all the variables which have been set in
> > $global set directly in the current package, automatically, like %fdat.
> >
> > For example, in one page we say $global->{foo} = "hello"; then, in
> > another (subsequently executed) page we would have a variable called
> > $foo automatically initialized for us to "hello".
> >
> > If you then change one of these variables, the change is reflected for
> > other pages. I don't know if this is technically possible because I am
> > still a little fuzzy on the details of how Perl manages namespaces and
> > variable references. But, knowing Perl, it should be possible...
> >
> > Does this make any sense? It would enable more global variables and make
> > it easier to code these, while keeping each page in its own package, and
> > resulting in tidier code (in my opinion). I'm just thinking about the
> > variables that Embperl currently automatically sets for us - couldn't it
> > also automatically add references to other variables, based on the
> > contents of an object like $global?
> >
> > This is just an idea, perhaps not fully formed, and I have no idea how
> > hard it would be in practice. Any comments?
> >
> > TIA
> >
> > -Neil
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]