perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luiz Fernando B. Ribeiro" <l...@engenhosolucoes.com.br>
Subject Re: bug report for 1.3
Date Thu, 27 Nov 2003 12:22:09 GMT
On Thu, 27 Nov 2003 20:58:32 +1100, Michael (Micksa) Slade 
<micksa@knobbits.org> wrote:

> http://knobbits.org/embperlobject-inheritance-bug.tar.gz
>
> load up /test/dir1/sub/foo.html
>
> (or http://knobbits.org/test/dir1/sub/foo.html if you like)
>
> Some sort of memory corruption or something I guess.  It happens all the 
> time, at least.
>
> This happens in both 1.3.6 (debian testing) and 1.3.3 (debian stable).
>
> Can some please fix this for me? thanks :)
>

I think your approach in using EmbperlObject is not correct.
If you have components that need to be "casacaded" trough a directory tree 
its better to isolate them out of the "template" page.

The template should have all the needed "Executes" to these components and 
don't forget the magical Execute('*') to include the requested page. But 
don't reference back the parent's template the way you are doing.

Example:

/
|
| base.epr
| index.epo
| component1.epr
| component2.epr
| SUB_FOLDER /
              |
              | component1.epr
              | component2.epr
              | index.epo
              | OTHER_FOLDER /
                             |
                             | component1.epr
                             | index.epo

in base.epr:

[-
Execute('component1.epr');
Execute('component2.epr');
$req = shift;

# code
-]
<html>
...
[- Exeute('*'); -]
...
</html>



in component1.epr (The root level one):
[-
$req = shift;

# code

$req->{var1} = $object;
$req->{var2} = \%reference;
-]

component2.epr contains other pieces of code to be reused.

in the other levels (folders), the components may safely reference the 
parent's one:

in component1.epr (in SUB_FOLDER):
[-
Execute('../component1.epr');
$req = shift;

# code that add or change variables from parent's component1.epr

$object = $req->{var1};
$reference = $req->{var2};
$object->do_something();
$reference->{value}++;
-]

Hope this helps.

-- 
Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet

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


Mime
View raw message