Gerald Richter wrote:
>
> Neil,
>
> I think what you need here is to use Perl methods instead of plain
> functions. EmbperlObject bless's the Embperl Request Object into the package
> of the current calling page, so you are able to call the correct subroutine
> by using the method call syntax. (and you don't need to import anything at
> all)
>
> Again look at
>
> http://perl.apache.org/embperl/EmbperlObject.pod.5.html#Example_for_using_me
>
> that should show how it works. If it isn't clear don't hestitate to ask
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. 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 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. I am not an expert Perl programmer, so
perhaps I am missing the simple way of doing this. Is anyone on this
mailing list using EmbperlObject in this way, and if so could you please
provide an example as a design pattern?
This has become a real block for me, and I would like to just get on
with actual implementation rather than batting my head against a brick
wall with basic architecture stuff... 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! But I am simply trying to
get the design of my Embperl websites correct, since the way I have been
doing it up to now is obviously incorrect. So I am in the weird position
of having quite a lot of existing code which really does work pretty
well but is (now) obviously wrong. Can anyone enlighten me with a design
pattern for including methods/subroutines from other files while still
using the EmbperlObject framework?
TIA
-Neil
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]