>
> Gerald, I hesitate to continue on this because it seems like I keep
> asking the same question. But really, you didn't answer my previous
> query so I have to try again.

Don't hestitate to ask again, if I understand you wrong! Maybe it wasn't
obvious to me what you ment, maybe I simply wasn't able to understand it
after 12 hours of work....

> I understand, I think, the use of Perl
> methods that you refer to above. What this gives you is an inheritance
> hierarchy with the package of the requested page inheriting from the
> base.html. So you can over-ride methods and write global data, which is
> great. What still isn't obvious to me is how you include subroutines (or
> methods!) from *other* files. I don't want to put all my methods in
> base.html or the '*' (i.e. requested) file.

I thought you wanted to call sub's in '*', if they are in other files then
my suggestion doesn't work of course.

> I want to include files like
> 'subs.html' from base.html - and then allow subs.html to be redefined in
> subdirectories. This concept could be widened to include an arbitrary
> number of different packages (classes). I assume that subs.html would in
> turn have its own inheritance hierarchy, but since each document has its
> own package, the methods in subs.html seem to be inaccessible to
> base.html and its children.

>From a Perl point of view you are right. As long as you don't know the
package name in which the file is compiled, you can't call the sub's via
Perl, but you can call them via the Execute ('subs.html#foo') method. This
should work quite corrected, also if you have different subs.html in
different subdirectories. I think you already realized that.

This is ok, as long as you don't call too much of such sub's via Execute.
Execute, especialy under EmbperlObject introduces some overhead. So if you
need to call them very often we have to think of another way to do it.
Currently Embperl has no other way build in, so we have to create one of our
own. One idea that comes to my mind, is to call a constructor inside
subs.html, which returns an obeject, that you can use to call further subs
inside this document. Example:

base.html:
[-
# We just load and compiled the file here,
#   no real import takes place
Execute ({inputfile => 'subs.html', import => 0}) ;

# Now we call the constructor
Execute ({inputfile => 'subs.html#NEW', param => \@p}) ;

# and now we have an object ref to do further calls
$o = $p[0] ;

# call a method inside subs.html
$o -> foo ;
-]

subs.html

[$sub NEW $]
[-
my $o = {} ;

bless $o, __PACKAGE__ ;
$param[0] = $o ;
-]
[$endsub$]

[!

# maybe a Perl or Embperl sub
sub foo { # do anything } ;
!]

This is a quick idea and I haven't tested it, but it should work. (I hope I
had understood you right this time)

>I realize that this is a free
> email support list, and believe me I am acutely aware of the fact that I
> have been asking a lot of questions recently!

Neil, you have asked very good question. I always like to hear where people
have problem with Embperl and your question have shed some light on points
of EmbperlObject, which aren't as good as they could/should be. So keep on
asking, it will help me to make Embperl better, also I don't always have the
time to write long responses. (providing support can be a very time
consuming task, and I have of course some other work to do...)

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 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to