perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luiz Fernando <l...@engenhosolucoes.com.br>
Subject Re: Execute without __PACKAGE__
Date Tue, 17 Jun 2003 13:56:21 GMT
On Mon, 2003-06-16 at 17:02, ckassab@eplsite.org wrote:
> Hi all:
> 
> 
> Eplsite(www.eplsite.org) is a good system to run as CGI but when running
> with mod_perl it will consume memory because it is using Execute with
> __PACKAGE__
> 
> The main file is called index.epl and it is executing some files containing
>  subs, when i try to change the way to execute files like this:
> 
> [- Execute ({inputfile => 'mainprogram.epl', import => 1 }); -]
> [- Execute ($theeplsitepath.'skins/'.$skin.'/colors.epl'); -]
> [- Execute ({inputfile => $theeplsitepath.'includes/subs.epl', import =>
> 1}); -]
> 
> 
> and then i execute :
> 
> Execute ({inputfile =>'modules/'.$main_module.'/news_module.epl'});
> 
> And now i try to call the subroutine theheader(contained int
> mainprogram.epl) from news_module.epl
> 
> i allways get an error message " subroutine theheader not declared ".
> 

I suggest you to take a look at EmbperlObject, it would be a cleaner and
better solution.

Functions declared in your "base.epl", for example, are accessible
trough the $req object as methods, example:

In base.epl

[$ sub test $]
  [-
  # some code
  -]
  [+ $output +]
[$ endsub $]

[!
sub other_sub {
  # common perl sub
}
!]

[- Execute('heder.epl'); -]
[- Execute('*'); -]
[- Execute('footer.epl'); -]

In your pages:
[-
$req = shift;
$req->test;
$req->other_sub;
-]

Or you can put all your subs in a shared file and use the "isa"
parameter to Execute.

Regards,

-- 
Luiz Fernando Ribeiro
Engenho Soluções S/C Ltda


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


Mime
View raw message