You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kee Hinckley <na...@somewhere.com> on 2001/03/21 15:29:53 UTC

Scoping typglobs in embperl

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 5:39 AM +0100 3/21/01, Gerald Richter wrote:
>[* *] are still experimental in Embperl 1.x. I know that they don't work
>correctly in all situations. Please use [+ +] or [- -] instead.

A thought related to [* *]

I'm using DBIx::Recordset (very nice) in some of my embperl pages. 
Because it uses typglobs, I get concerned about scope, and having one 
part of page interfering with some other part, expecially if I'm 
including multiple embperl files in an EmbperlObject environment, so 
I do this:

[* { local (*set); *]
...
[- *set = somerecordsetcall -]
...
do something with *set
...
[* } *]

a) Does this make sense, or am I causing myself unforeseen problems?
b) Might there be a better way to deal with this, by adding some new 
[$ construct for instance.  Something like:
	[$ local *foo $bar $]
...
	[$ endlocal $]
- -- 

Kee Hinckley - Somewhere.Com, LLC - Cyberspace Architects
Now Playing - Folk, Rock, odd stuff - http://www.somewhere.com/playlist.cgi

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBOrjDySZsPfdw+r2CEQJtNACeN3pUTx0MhEGT0LRPtV2lrx419S0AnRSR
BeDlLHNmHSFu2Jh8ufc1NG/6
=GEWR
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Scoping typglobs in embperl

Posted by Gerald Richter <ri...@ecos.de>.
>
> At 5:39 AM +0100 3/21/01, Gerald Richter wrote:
> >[* *] are still experimental in Embperl 1.x. I know that they don't work
> >correctly in all situations. Please use [+ +] or [- -] instead.
>
> A thought related to [* *]
>
> I'm using DBIx::Recordset (very nice) in some of my embperl pages.
> Because it uses typglobs, I get concerned about scope, and having one
> part of page interfering with some other part, expecially if I'm
> including multiple embperl files in an EmbperlObject environment, so
> I do this:
>
> [* { local (*set); *]
> ...
> [- *set = somerecordsetcall -]
> ...
> do something with *set
> ...
> [* } *]
>
> a) Does this make sense, or am I causing myself unforeseen problems?

This should work, but I am not quite sure if Perl really cleans up the whole
DBIx::Recordset object in this way

> b) Might there be a better way to deal with this, by adding some new

Every single file have it's own namespace, so there can't be any
interferences between different files, also Embperl knows about
DBIx::Recordset and makes sure every DBIx::Recordset is closed and cleaned
up correctly at the end of the request.

If you want to cleanup a DBIx::Recordset in the middle of the page, you can
simple say

[- DBIx::Recordset::Undef ('set') -]


Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org