Neil,

>
> Sorry about the repeated emails regarding this issue,

No problem, as more information you can provide for me, as easier it is for
me to find the problem :-)

>but I continue to
> play with the problem and have come up with more possible behavioral
> clues. In my previous email, I said that Execute('#foo') worked.
> However, I now discover that it ONLY works if [$ sub foo $] is in the
> same file as the call to Execute('#foo'). When I move the [$ sub $]
> definition out into a subroutines file (which is Executed to import the
> subs) then I consistently get an error "Call to unknown Embperl macro
> foo" on Execute('#foo').

This is exactly as it should be. To call an sub in another file via Execute
you have to provide the filename, e.g.

Execute ('bar.html#foo') ;

but the file must be already loaded before, to make sure it is, do a

Execute (inputfile => 'bar.html', import => 0) ;

before. (This import => 0 isn't neccessary anymore in Embperl 2.0)

import => 1 only works for import the sub's in the Perl namespace of the
current document. import => 0 only loads the file into memory, compiles it,
but doesn't do any import.

>
> Also, the call works if I import using import=>1 and just call it using
> [- foo -].
>

Yes, that's what import does.

> ... The calling mechanisms are obviously very different, it's
> just interesting to note that the simple Perl method of calling the [$
> sub $] seems to get confused with another subroutine of the same name,
> in a completely different directory subtree.
>

This maybe because of the imports. From where do you call these subroutines.
>From your base template or from the same file where the sub are defined? Are
you doing any imports ?

> Also, I have noticed that even calling a non-existent subroutine name
> does not appear to generate an error, when using the [- xxxx -] form.
> There is simply no output.

Yes, because that's not a subroutine call. Perl will stringify the xxxx, so
it executes [- 'xxxx' -] , which does of course nothing and isn't an error.
To call an unknows subroutine you must write [- &xxxx -] or [- xxxx() -]

>However the [- Execute('#xxxx') -] form does
> generate an error.

Yes, because this does a subroutine call

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