Gerald, 

First of all, thanks for taking the time to explain these things. I
understand better now about the problem with using __PACKAGE__ to
include my subroutine files. However I have to admit that I am still
thoroughly confused by the behavior of Execute() with regard to
subdirectories. I just cannot seem to get my subroutines to be visible
unless I use __PACKAGE__. It all works fine in the base directory, but
as soon as I try doing things in subdirectories the subs are invisible -
I get internal server errors whenever I try to call them. I have tried
using every permutation of the 'import' parameter to Execute(), but it
makes no difference. As you say, it will use much more memory if I use
__PACKAGE__, so I do want to get this right.

So, if you have the time, could you please explain for me how I should
implement the following scenario. I have left it as simple as possible,
since I am not sure at this point how to do it. Basically what I want to
here do is include the Perl subroutines from subs.html into base.html,
and then call '*' with those subroutines enabled. So in the '*' file I
should be able to just
call the Perl subs. The thing is, subs.html may be over-ridden in
subdirectories, so we have to make sure that the parent is called.
Here's the general layout:

/base.html
        [- Execute ('subs.html') -]
        [- Execute ('*') -]

/subs.html
        [- sub xxx { print OUT "xxx" } -]

/foo/subs.html
        [- Execute ('../subs.html') -]
        [- sub foo { print OUT "foo" } -]

/foo/index.html
        [- xxx -]
        [- foo -]

When I try this exactly as I have it here, the browser just sits and
waits for about 15 seconds, before displaying a message that the
document contained no data. There doesn't seem to be much in the embperl
log either. Should that happen? Should this work as it is?

The key lines here are the Execute() statements. I cannot seem to find a
combination of parameters (e.g. import=>1) which makes /foo/index.html
actually see xxx() and foo(). Here are some specific questions.

1. To enable this scenario, should the calls to Execute() in base.html
use import=>1, or 0, or not at all?

2. Should the call to Execute('../subs.html') in /foo/subs.html be
necessary? I assume it is, if you want to add subroutines to the ones
defined by the parent file.
What form should this call take? Does it need import?

3. Should the call to Execute('*') be as simple as that?

Sorry if this seems like basic stuff, I've actually been using Embperl
for a while now quite happily, but using __PACKAGE__ from base.html to
include subroutines. Since you've pointed out the memory issues with
that (and the problem I just ran into of name conflicts), I really want
to get the architecture right. And I can see how 'import' works in the
simple case, but not when you have subdirectories which over-ride higher
directories.

If you could enlighten me as to what the correct practice is here, I
would be most grateful.

Thanks again,

-Neil

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

Reply via email to