Andre Landwehr writes:
> On Sat, Oct 07, 2000 at 08:14:59PM +0000, neil wrote:
> >
> > There are two features which I think would be good to have in
> > EmbperlObject. I would like to know what you think:
> >
> > 1. The ability for Execute() to look up the directory tree if it can't find
> > the named file, in the same way that the EMBPERL_OBJECT_BASE is searched
> > for. This would enable more true object-orientation than at present, where
> > a file that tries [- Execute ('../file.html') -] will fail if the parent
> > directory has no file.html. However file.html may exist further up the
> > hierarchy, in which case that one should be found.
> > (...)
>
> Just say [- Execute "file.html" -] instead of "../file.html" and
> it works. The only problem with this is that you cannot
> explicitly skip file.html in the current directory if it exists, so you
> will have to work around that somehow (which is not nice but not
> too complicated either, I did that several times)
>
> Andre
Thanks Andre - but a major reason for my request was the case where you DO
have file.html in the current directory, and this file wants to include
(i.e. call Execute() on) its parent. This is a fairly common occurrence in
object-oriented designs.
The problem comes when you have intermediate parent directories (i.e.
between the current directory and the website root) which may or may not
have 'file.html' defined - this means that you have to redefine file.html
all the way up the hierarchy (each one perhaps just calling its parent),
which clutters up the directories.
The other point was that multiple calls of the form Execute('../file.html')
from the same hierarchy will not work, as Embperl apparently uses the
literal filename which is supplied to Execute() to uniquely identify the
file in the cache. To workaround this I currently have to make a special
symbolic link in each of my directories, which links to the immediate
parent directory. I name the link according to what the current directory
is. So, if I am in a directory called foo, then I make a link called foo..
which points to the parent (..). Now, to call the parent file.html from
within foo/file.html, I use Execute ('foo../file.html').
This works, but it doesn't really feel good. I would much prefer it if
EmbperlObject could both handle going up the directory tree itself if
Execute() fails to find the named file in the specified directory, and also
be able to handle multiple instances of the form '../file.html'.
Hope this makes sense...
Thanks again
-Neil
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]